Stock Locations
Allows suppliers to define and manage multiple inventory locations, enabling stock levels to be viewed by customers per location.
Authentication
Requests must include a bearer token in the HTTP Authorization header.
Endpoints at a glance
| METHOD | Endpoint | Description | Path Parameters |
|---|---|---|---|
| GET | /org/:org_id/stock_locations/ | Get all stock locations | org_id |
| GET | /org/:org_id/stock_locations/:stock_location_id/ | Get a specific stock location | org_id, stock_location_id |
| POST | /org/:org_id/stock_locations/ | Create stock location | org_id |
| PATCH | /org/:org_id/stock_locations/:stock_location_id/ | Update stock location | org_id, stock_location_id |
| DELETE | /org/:org_id/stock_locations/:stock_location_id/ | Delete stock location | org_id, stock_location_id |
:org_id: your OpenSolar Organization ID:stock_location_id- ID number of the stock location
Get All Stock Locations
Fetches all the stock locations for a given Organization.
Request
This endpoint does not require a JSON payload.
curl -X GET 'http://api.opensolar.com/api/orgs/<ORG_ID>/stock_locations/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE'
Response
[
{
"id": <STOCK_LOCATION_ID>,
"url": "http://api.opensolar.com/api/orgs/<ORG_ID>/stock_locations/<STOCK_LOCATION_ID>/",
"key": "nottingham_warehouse",
"name": "Nottingham Warehouse",
"address": "123, Nottingham, UK",
"contact_email": "susan.rays@solarsupplier.com",
"is_active": true,
"created_at": "2026-01-14T12:29:14.700269Z",
"updated_at": "2026-01-14T12:29:14.700295Z"
},
{
"id": <STOCK_LOCATION_ID>,
"url": "http://api.opensolar.com/api/orgs/<ORG_ID>/stock_locations/<STOCK_LOCATION_ID>/",
"key": "london_warehouse",
"name": "London Warehouse",
"address": "123, London, UK",
"contact_email": "susan.rays@solarsupplier.com",
"is_active": true,
"created_at": "2026-01-14T12:38:50.525332Z",
"updated_at": "2026-01-14T12:38:50.525366Z"
}
]
Status Codes
- 200 OK.
- 400 Bad Request – Invalid request format or missing data.
Get Specific Stock Location
Fetches data regarding a specific stock location set up by a Supplier.
Request
This endpoint does not require a JSON payload.
curl -X GET 'http://api.opensolar.com/api/orgs/<ORG_ID>/stock_locations/<STOCK_LOCATION_ID>/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE'
Response
{
"id": <STOCK_LOCATION_ID>,
"url": "http://api.opensolar.com/api/orgs/<ORG_ID>/stock_locations/<STOCK_LOCATION_ID>/",
"key": "nottingham_warehouse",
"name": "Nottingham Warehouse",
"address": "123, Nottingham, UK",
"contact_email": "susan.rays@solarsupplier.com",
"is_active": true,
"created_at": "2026-01-14T12:29:14.700269Z",
"updated_at": "2026-01-14T12:29:14.700295Z"
}
Status Codes
- 200 OK.
- 400 Bad Request – Invalid request format or missing data.
- 404 Not Found – Stock location not found.
Create Stock Location
Create a new stock location.
Payload
{
"key": "nottingham_warehouse",
"name": "Nottingham Warehouse",
"address": "123, Nottingham, UK",
"contact_email": "susan.rays@solarsupplier.com"
}
Request
curl -X POST 'http://api.opensolar.com/api/orgs/<ORG_ID>/stock_locations/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE' \
--data '{
"key": "nottingham_warehouse",
"name": "Nottingham Warehouse",
"address": "123, Nottingham, UK",
"contact_email": "susan.rays@solarsupplier.com"
}'
Note: The
keymust be unique and cannot be updated once created.
Response
{
"id": 7,
"url": "http://api.opensolar.com/api/orgs/<ORG_ID>/stock_locations/7/",
"key": "nottingham_warehouse",
"name": "Nottingham Warehouse",
"address": "123, Nottingham, UK",
"contact_email": "susan.rays@solarsupplier.com",
"is_active": true,
"created_at": "2026-01-14T12:29:14.700269Z",
"updated_at": "2026-01-14T12:29:14.700295Z"
}
Status Codes
- 201 Created – The stock location was successfully created.
- 400 Bad Request – Invalid fields or missing parameters.
- 409 Conflict – A stock location with the given key already exists.
Update Stock Location
Update a given stock location. Please note that the key cannot be updated post-creation.
Payload
{
"name": "New London Warehouse",
"key": "london_warehouse",
"address": "123 street, London, UK",
"contact_email": "jane@solarsupplier.com"
}
Request
curl -X PATCH 'http://api.opensolar.com/api/orgs/<ORG_ID>/stock_locations/<STOCK_LOCATION_ID>/' \
--header 'Content-Type: application/json' \
--data '{
"name": "New London Warehouse",
"key": "london_warehouse",
"address": "123 street, London, UK",
"contact_email": "jane@solarsupplier.com"
}'
Response
{
"id": <STOCK_LOCATION_ID>,
"url": "http://api.opensolar.com/api/orgs/1056/stock_locations/<STOCK_LOCATION_ID>/",
"key": "london_warehouse",
"name": "New London Warehouse",
"address": "123 street, London, UK",
"contact_email": "jane@solarsupplier.com",
"is_active": true,
"created_at": "2026-01-14T12:38:50.525332Z",
"updated_at": "2026-01-14T12:57:50.860885Z"
}
Status Codes
- 200 OK – The changes were saved successfully.
- 400 Bad Request – Invalid input or missing fields.
- 404 Not Found – Stock location not found.
Delete Stock Location
Delete a stock location.
Request
This endpoint does not require a JSON payload.
curl -X DELETE 'http://api.opensolar.com/api/orgs/<ORG_ID>/stock_locations/<STOCK_LOCATION_ID>/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE'
Response
None
Status Codes
- 204 Accepted – Successfully deleted.
- 400 Bad Request – Invalid request format or missing data.
- 404 Not Found – Stock location not found.