Get services
A service is an order for parts placed on Cortecloud, and it corresponds to an order in your ERP. The service becomes visible to your integration from quote generated (4) onward.
The usual flow is to list the services the ERP is interested in and query each one to get its full content. To be notified of status changes instead of listing periodically, use webhooks.
List services
Route: GET /services.
For each service, the listing returns id, internal_code and the status object with the status code and the date of each stage. The full content (parts, materials, amounts) comes only in the individual lookup.
Filters accepted in the query string:
| Parameter | Use |
|---|---|
status | Status codes separated by commas. Accepts 4, 25, 6, 7 and 9 (see service status); without the filter, returns all of them. Other codes are rejected with 400. |
internal_code | Returns only the service with this internal code (the order number in the ERP). With the value null, returns only the services that do not have an internal code yet. |
date_start, date_end | Filter by the date of the service's last change. date_start cannot be later than date_end. |
limit, offset | Pagination; see Errors, limits and pagination. |
Steps:
- Call
GET /serviceswith the filters for your case. To fetch new orders for the ERP, for example, combinestatus=6(approved) withinternal_code=null(no ERP order yet). - Process the items in
resource. - If
meta.nextis not null, repeat the call withoffsetequal tometa.next. This route accepts 1 request every 5 seconds: wait between one page and the next. - When
meta.nextcomes back null, the listing is over.
Sample response:
{
"resource": [
{
"id": 123,
"internal_code": null,
"status": {
"code": 6,
"created_date": "…",
"budgeted_date": "…",
"purchased_date": "…",
"authorized_date": null,
"finished_date": null
}
}
],
"meta": {
"count": 1,
"next": null
}
}
The dates in status mark each stage: creation (created_date), quote generated (budgeted_date), approval (purchased_date), sending to production (authorized_date) and end of production (finished_date). Stages not yet reached come back null.
Get a service
Route: GET /services/{id}.
Returns the full content of the service:
| Field | Content |
|---|---|
status, history | Current status with the date of each stage and the history of status changes. The history includes only the changes to quote generated (4), approved (6), sent to production (7) and produced (9). |
steps | Dates of the production stages: cutting, edge banding application, machining, packing and dispatch. |
client | Internal code of the carpenter at the service center (the customer code in your ERP). |
labour | Labor amounts: cutting, edge banding application, machining (with the summary of holes and grooves), packing and shipping. |
materials | Boards, edge banding and hardware components consumed, with internal code, quantity and price. |
parts | List of parts: dimensions, quantity, board, edge banding applied to each side, drilling and machining. |
The internal codes in materials and parts are the same ones your integration maintains through the materials routes, which lets you match each item of the service with the ERP item.
Responds with 404 when the service is not found. The full format of each field is in the operation in Swagger.
Next step
After registering the order in the ERP, link the order code to the service.