Skip to main content

Send batches of services

A batch groups the service center's services for production. Your integration builds the batch in your system and sends it to Cortecloud, which stores the grouping and shows it to production and to PCP. A service can be in several batches, and the batch does not change the service.

Two routes, both require service-center authentication (HMAC):

RouteUse
POST /batchesCreates the batch and returns its id.
PUT /batches/{id}Updates the batch by id.

Create a batch​

{
"internal_code": "LOTE-0042",
"description": "Morning shift",
"services": [
{ "id": 1234 },
{ "internal_code": "PED-000123" }
]
}
  • internal_code is the batch code in your system and is required. It cannot repeat within the service center.
  • description is optional.
  • services is required on creation, with 1 to 100 services per request.
  • Each service is identified by id or by internal_code; sending both on the same service is rejected with 400.

The 201 response carries the batch id. Keep it: the update requires this id.

Update a batch​

Only the fields sent change, and you must send at least one:

FieldEffect
internal_codeChanges the batch code. Absent keeps it.
descriptionChanges the description. Absent keeps it; null clears it.
servicesReplaces the whole list: services left out are removed from the batch, and [] empties it. Absent keeps the services.
{ "services": [{ "id": 1234 }, { "id": 1235 }] }

The update overwrites edits made in Cortecloud. Repeating the same call does not change the result.

Which services are accepted​

The service must be produced at the request's service center and released to production (status 7, 13, 21 or 22). A finished (9) or not yet released service is rejected.

A service internal_code that matches more than one of the center's services is ambiguous, and the whole batch is rejected. In that case, send the id. The lookup covers services in every status, so an old service with the same code also causes ambiguity.

Errors​

StatusWhen
400Malformed body: no internal_code or no services on creation, empty body on update, a service with neither id nor internal_code or with both, more than 100 services.
404On update, batch does not exist or belongs to another service center.
409A batch with this internal_code already exists at the service center.
422Some service cannot be part of the batch.

On 422, the problems field lists each rejected service and the reason:

{
"status": 422,
"problems": [
{ "ref": { "id": 1234 }, "reason": "finished" },
{ "ref": { "internalCode": "PED-000123" }, "reason": "ambiguous" }
]
}
reasonMeaning
not_foundService does not exist or belongs to another service center.
ambiguousinternal_code matches more than one service; send the id.
finishedService is finished.
not_releasedService is not yet released to production.
duplicatedService repeated in the list.

A batch with a rejected service is neither created nor changed.

Lost response on creation

If the POST response is lost, a retry receives 409 without the batch id. In that case, contact support to recover it.