Cost Categories
Cost Categories are used to breakdown purchase order costs into different categories (i.e. Material, Labor, etc). Cost Categories are defined per-phase for phase codes related to jobs. They can also be defined per-job or globally for the organization.
Schema​
Cost Category
​
Name | Type | Description | Example |
---|---|---|---|
id | ID | The unique ID | "ckmnpybisiy5x08abky4g2d1f" |
createdAt | DateTime | When this cost category was created | "2021-03-24 17:26:46.983Z" |
code | string | The human-readable code to identify this cost category | "M" |
phase | Phase | Associated phase code | See Phases docs |
description | string | A description of this cost category | "Material" |
job | Job | The job this cost category is associated with | See Jobs docs |
updatedAt | DateTime | When this cost category was last modified | "2021-03-24 17:26:46.983Z" |
Queries​
costCategory
​
Read a single cost category.
Parameters​
For global cost categories, a code or id must be specified.
For phase-related cost categories, a cost category code can only be used alongside a phase id, a phase code and job code, or a phase code and job id.
For job-related cost categories, a cost category code can only be used alongside a job code or job id.
Name | Type | Description | Example |
---|---|---|---|
code | string | A unique human-readable code to represent this cost cateogry | "M" |
description | string | A description of the cost category | "Material" |
phaseCode | string | The code of the phase this cost category is linked to | "01-300" |
phaseId | ID | The ID of the phase this cost category is linked to | "ckmnpybisiy5x08abky4g2d1f" |
jobCode | string | The code of the job this cost category is linked to | "01-300" |
jobId | ID | The ID of the job this cost category is linked to | "ckmnpybisiy5x08abky4g2d1f" |
id | ID | The cost category ID | "ckmnpybisiy5x08abky4g2d1f" |
Response​
A single CostCategory
.
Example Query (Global)​
query {
costCategory(code: "M") {
code
description
id
}
}
Example Response (Global)​
{
"code": "M",
"description": "Material",
"id": "ckmnpybisiy5x08abky4g2d1f"
}
Example Query (Phase-Related)​
query {
costCategory(code: "M", phaseId: "5dgapybifdsvxsdg4ky4g25xz") {
code
description
id
phase {
id
}
}
}
Example Response (Phase-Related)​
{
"code": "M",
"description": "Material",
"id": "ckmnpybisiy5x08abky4g2d1f",
"phase": {
"id": "5dgapybifdsvxsdg4ky4g25xz"
}
}
costCategories
​
Reads a list of cost categories
Parameters​
If no phase or job information is provided, global cost categories are returned.
If phase information is provided, phase-related cost categories are returned.
If only job information is provided, job-related cost categories are returned.
Name | Type | Description | Example |
---|---|---|---|
code | string | A unique human-readable code to represent this cost cateogry | "M" |
description | string | A description of the cost category | "Material" |
phaseCode | string | The code of the phase this cost category is linked to | "01-300" |
phaseId | ID | The ID of the phase this cost category is linked to | "ckmnpybisiy5x08abky4g2d1f" |
jobCode | string | The code of the job this cost category is linked to | "01-300" |
jobId | ID | The ID of the job this cost category is linked to | "ckmnpybisiy5x08abky4g2d1f" |
id | ID | The cost category ID | "ckmnpybisiy5x08abky4g2d1f" |
Accepts all standard pagination parameters.
Allowed orderBy fields: code
, createdAt
, description
, id
, updatedAt
.
Allowed filter fields: code
, createdAt
, description
, id
, updatedAt
.
Response​
A list of CostCategory[]
.
Example Query (Global)​
query {
costCategories() {
code
description
id
}
}
Example Response (Global)​
[
{
"code": "M",
"description": "Material",
"id": "ckmnpybisiy5x08abky4g2d1f"
},
{
"code": "L",
"description": "Labor",
"id": "234faybis20983phasfg2dgzx"
}
]
Example Query (Phase-Related)​
query {
costCategories(phaseId: "ckmnpybisiy5x08abky4g2d1f") {
code
description
id
phase {
id
}
}
}
Example Response (Phase-Related)​
[
{
"code": "M",
"description": "Material",
"id": "144dpybisiy52dgabky4g2dxz",
"phase": {
"id": "ckmnpybisiy5x08abky4g2d1f"
}
}
]
Example Query (Job-Related)​
query {
costCategories(jobId: "ckmnpybisiy5x08abky4g2d1f") {
code
description
id
job {
id
}
}
}
Example Response (Job-Related)​
[
{
"code": "M",
"description": "Material",
"id": "144dpybisiy52dgabky4g2dxz",
"job": {
"id": "ckmnpybisiy5x08abky4g2d1f"
}
}
]
phaseCostCategories
​
Reads a list of all phase-related cost categories
Response​
A list of CostCategory[]
.
Example Query​
query {
phaseCostCategories {
code
description
id
phase {
id
}
}
}
Example Response​
[
{
"code": "M",
"description": "Material",
"id": "144dpybisiy52dgabky4g2dxz",
"phase": {
"id": "ckmnpybisiy5x08abky4g2d1f"
}
},
{
"code": "L",
"description": "Labor",
"id": "ckxot4jmt4256mqtcyrgfrl9y",
"phase": {
"id": "ckxot4jq74404mqtct51649rt"
}
},
]
jobCostCategories
​
Reads a list of all job-related cost categories
Response​
A list of CostCategory[]
.
Example Query​
query {
jobCostCategories {
code
description
id
job {
id
}
}
}
Example Response​
[
{
"code": "M",
"description": "Material",
"id": "144dpybisiy52dgabky4g2dxz",
"job": {
"id": "ckmnpybisiy5x08abky4g2d1f"
}
},
{
"code": "L",
"description": "Labor",
"id": "ckxot4jmt4256mqtcyrgfrl9y",
"job": {
"id": "ckxot4jq74404mqtct51649rt"
}
},
]
createCostCategory
​
Read a cost category.
Parameters​
For global cost categories, the phase id is left out.
To create a phase-related cost category, a phase id must be provided, or a phase code along with either a job code or job id.
To create a job-related cost category, a job code or job id must be provided.
Name | Type | Description | Example |
---|---|---|---|
code | string | A unique human-readable code to represent this cost cateogry | "M" |
description | string | A description of the cost category | "Material" |
phaseCode | string | The code of the phase this cost category is linked to | "01-300" |
phaseId | ID | The ID of the phase this cost category is linked to | "ckmnpybisiy5x08abky4g2d1f" |
jobCode | string | The code of the job this cost category is linked to | "01-300" |
jobId | ID | The ID of the job this cost category is linked to | "ckmnpybisiy5x08abky4g2d1f" |
id | ID | The cost category ID | "ckmnpybisiy5x08abky4g2d1f" |
Response​
The created CostCategory
.
Example Query​
mutation {
createCostCategory(code: "M", description: "Material", phaseId: "ckmnpybisiy5x08abky4g2d1f") {
code
description
id
}
}
Example Response​
{
"code": "M",
"description": "Material",
"id": "ckmnpybisiy5x08abky4g2d1f"
}
updateCostCategory
​
Update the description of a cost category.
Parameters​
Any cost category can be updated by providing the id.
The different types of cost categories can also be updated by providing the information below.
A global cost category can be updated by provide just the code.
A phase-related cost category can be updated by providing the code along with a phase id, or a phase code and job code.
A job-related cost category can be updated by providing a code along with a job code or job id.
Name | Type | Description | Example |
---|---|---|---|
code | string | A unique human-readable code to represent this cost cateogry | "M" |
description | string | A description of the cost category | "Material" |
phaseCode | string | The code of the phase this cost category is linked to | "01-300" |
phaseId | ID | The ID of the phase this cost category is linked to | "ckmnpybisiy5x08abky4g2d1f" |
jobCode | string | The code of the job this cost category is linked to | "01-300" |
jobId | ID | The ID of the job this cost category is linked to | "ckmnpybisiy5x08abky4g2d1f" |
id | ID | The cost category ID | "ckmnpybisiy5x08abky4g2d1f" |
Response​
The updated CostCategory
.
Example Query​
mutation {
updateCostCategory(code: "M", description: "Material", phaseId: "ckmnpybisiy5x08abky4g2d1f") {
code
description
id
}
}
Example Response​
{
"code": "M",
"description": "Material",
"id": "ckmnpybisiy5x08abky4g2d1f"
}