Skip to main content

Price Tiers

Allows Suppliers to define pricing tiers independently, which can later be assigned to the Organizations via their OrgID. These tiers will define the pricing the Organizations see and purchase at on the platform.


Authentication​

Requests must include a bearer token in the HTTP Authorization header.


Endpoints at a glance​

METHODEndpointDescriptionPath Parameters
GET/org/:org_id/price_listGet all price tiersorg_id
GET/org/:org_id/price_list/:price_list_idGet price tier infoorg_id, price_list_id
POST/org/:org_id/price_listCreate price tierorg_id
PATCH/org/:org_id/price_list/:price_list_idUpdate price tierorg_id, price_list_id
DELETE/org/:org_id/price_list/:price_list_idDelete price tierorg_id, price_list_id
  • :org_id: your OpenSolar Organization ID
  • :price_list_id - ID number of the price list

Get All Price Tiers​

Pulls data regarding all price tiers 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>/price_list/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE'

Response​

[
{
"id": 1,
"url": "http://api.opensolar.com/api/orgs/97/price_list/1/",
"key": "gold",
"name": "Golden Price Tier",
"org_count": 0
},
{
"id": 2,
"url": "http://api.opensolar.com/api/orgs/97/price_list/2/",
"key": "silver",
"name": "Silver Price Tier",
"org_count": 1
}
]

org_count: the number of Organizations associated with the tier.

Status Codes

  • 200 OK.
  • 400 Bad Request – Invalid request format or missing data.

Get Price Tier​

Pulls data regarding a specific price tier 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>/price_list/<PRICE_LIST_ID>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE'

Response​

{
"id": 1,
"url": "http://api.opensolar.com/api/orgs/97/price_list/1/",
"key": "gold",
"name": "Golden Price Tier",
"org_count": 0
}

Status Codes

  • 200 OK.
  • 400 Bad Request – Invalid request format or missing data.
  • 404 Not Found – Price tier not found.

Create Price Tier​

Create a price tier.

Request payload​

{
"name": "Price List",
"key": "price_list_2"
}
curl -X POST 'http://api.opensolar.com/api/orgs/97/price_list/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE' \
--data '{
"name": "Price List",
"key": "price_list_2"
}'

Note: The key must be unique and cannot be updated once created.

Response​

{
"url": "http://api.opensolar.com/api/orgs/97/price_list/7/",
"key": "price_list_2",
"name": "price_list"
}

Status Codes

  • 201 Created – The price tier was successfully created.
  • 400 Bad Request – Invalid fields or missing parameters.
  • 409 Conflict – A price tier with the given key already exists.

Update Price Tier​

Update the name of the price tier. Please note that the key cannot be updated post-creation.

Request payload​

{
"name": "New Price List Name"
}
curl --location --request PATCH 'http://api.opensolar.com/api/orgs/97/price_list/1/' \
--header 'Content-Type: application/json' \
--data '{
"name": "New Price List Name"
}'

Response​

{
"url": "http://api.opensolar.com/api/orgs/97/price_list/1/",
"key": "123",
"name": "update price_list"
}

Status Codes

  • 200 OK – The changes were saved successfully.
  • 400 Bad Request – Invalid input or missing fields.
  • 404 Not Found – Price tier not found.

Delete Price Tier​

Delete a price tier. Note that deleting a price tier will remove the tier from all associated Organizations and default them to your base price.

Request​

curl -X DELETE 'http://localhost:8000/api/orgs/97/price_list/7/' \
--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 – Pricing tier not found.