Plan categories
The headings your public Plans page groups plans and packages under, in your order. Granted with plans.
The plan_category object
Every plan_category record carries these fields in this order, after object, which is always "plan_category".
| Field | Type | Description |
|---|---|---|
id | integer | |
name | string, up to 100 characters | The heading shown on the Plans page. One name per account (not case sensitive). |
description | string, up to 255 characters | A line under the heading; empty when none. |
ordering | integer | The category's place, lowest first. A new category is placed last; the order is changed by dragging in the app. Read-only. |
plans | integer | How many plans (any status) use the category. Read-only. |
packages | integer | How many service groups (packages, any status) use the category. Read-only. |
Example
{
"object": "plan_category",
"id": 42,
"name": "Example name",
"description": "An example description.",
"ordering": 1,
"plans": 1,
"packages": 1
} List plan categories
Parameters
| Parameter | In | Description |
|---|---|---|
limit | query | Records per page, 1 to 1000 (default 100). |
offset | query | Records to skip (default 0). |
Returns
A list envelope of plan_category records (see Pagination).
Request
curl "https://www.bizstim.com/api/v1/plan-categories" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Accept: application/json"<?php
$ch = curl_init('https://www.bizstim.com/api/v1/plan-categories');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/plan-categories', {
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json' }
});
const data = await response.json();Response
{
"object": "list",
"total": 2,
"limit": 100,
"offset": 0,
"has_more": false,
"data": [
{
"object": "plan_category",
"id": 42,
"name": "Example name",
"description": "An example description.",
"ordering": 1,
"plans": 1,
"packages": 1
},
{
"object": "plan_category",
"id": 43,
"name": "Example name",
"description": "An example description.",
"ordering": 1,
"plans": 1,
"packages": 1
}
]
} Retrieve a plan category
Parameters
| Parameter | In | Description |
|---|---|---|
id | path | The record's id. |
Returns
One plan_category record, or 404 not_found when no record with that id exists on your account.
Request
curl "https://www.bizstim.com/api/v1/plan-categories/42" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Accept: application/json"<?php
$ch = curl_init('https://www.bizstim.com/api/v1/plan-categories/42');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/plan-categories/42', {
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json' }
});
const data = await response.json();Response
{
"object": "plan_category",
"id": 42,
"name": "Example name",
"description": "An example description.",
"ordering": 1,
"plans": 1,
"packages": 1
} Create a plan category
Request body
A JSON object (Content-Type: application/json) with these fields.
| Field | Type | Required | Description |
|---|---|---|---|
name | string, up to 100 characters | yes | The heading (tags are removed). |
description | string, up to 255 characters | no | A line under the heading. |
Returns
201 with the new category record, placed last in the order. 400 invalid_request names the field to fix; 409 conflict when the account already has a category with that name.
Request
curl -X POST "https://www.bizstim.com/api/v1/plan-categories" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "High School",
"description": "Grades 9 to 12"
}'<?php
$ch = curl_init('https://www.bizstim.com/api/v1/plan-categories');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"name": "High School",
"description": "Grades 9 to 12"
}',
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/plan-categories', {
method: 'POST',
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify({
"name": "High School",
"description": "Grades 9 to 12"
})
});
const data = await response.json();Response (201)
{
"object": "plan_category",
"id": 42,
"name": "Example name",
"description": "An example description.",
"ordering": 1,
"plans": 1,
"packages": 1
} Update a plan category
Parameters
| Parameter | In | Description |
|---|---|---|
id | path | The record's id. |
Request body
A JSON object (Content-Type: application/json) with these fields.
| Field | Type | Required | Description |
|---|---|---|---|
name | string, up to 100 characters | no | The heading (cannot be emptied). |
description | string, up to 255 characters | no | A line under the heading; "" removes it. |
Returns
200 with the updated category record. Fields left out keep their values. 400 invalid_request; 404 not_found; 409 conflict when another category has that name.
Request
curl -X PATCH "https://www.bizstim.com/api/v1/plan-categories/42" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "High School (9-12)"
}'<?php
$ch = curl_init('https://www.bizstim.com/api/v1/plan-categories/42');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_POSTFIELDS => '{
"name": "High School (9-12)"
}',
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json', 'Content-Type: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/plan-categories/42', {
method: 'PATCH',
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json', 'Content-Type': 'application/json' },
body: JSON.stringify({
"name": "High School (9-12)"
})
});
const data = await response.json();Response
{
"object": "plan_category",
"id": 42,
"name": "Example name",
"description": "An example description.",
"ordering": 1,
"plans": 1,
"packages": 1
} Delete a plan category
Parameters
| Parameter | In | Description |
|---|---|---|
id | path | The record's id. |
Returns
200 with {"id", "object": "plan_category", "deleted": true}. 404 not_found; 409 conflict while a plan or a service group (package) uses it: move them first.
Request
curl -X DELETE "https://www.bizstim.com/api/v1/plan-categories/42" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "Accept: application/json"<?php
$ch = curl_init('https://www.bizstim.com/api/v1/plan-categories/42');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['X-API-KEY: YOUR_API_KEY', 'Accept: application/json'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);const response = await fetch('https://www.bizstim.com/api/v1/plan-categories/42', {
method: 'DELETE',
headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': 'application/json' }
});
const data = await response.json();Response
{
"id": 42,
"object": "plan_category",
"deleted": true
}