Get drafts by product

This endpoint returns the drafts of a product for the day specified in the request.

GET /api/v1/businesses/{businessId}/products/{productId}/drafts?day={yyyy-MM-dd}

If the data included in the request is correct —both businessId and productId—, the response will contain the drafts for the specified date with the following information:

  • orquestId: internal identifier of the draft in Orquest.

  • name: name of the draft.

  • creator: user who created the draft.

  • updater: last user who updated the draft.

  • created: date and time of creation in the format yyyy-MM-ddTHH:mm:ss.SSSZ.

  • updated: date and time of the last update in the format yyyy-MM-ddTHH:mm:ss.SSSZ.

  • status: status of the draft. Possible values are:

    • NONE - not scheduled.

    • QUEUED - in queue.

    • PROCESSING - being scheduled.

    • GENERATED - shifts generated, but no manual changes.

    • FAILED - failed.

    • CANCELED - canceled.

    • PUBLISHED - published with or without changes after generating shifts.

  • from: start date of the interval covered by the draft.

  • to: end date of the interval covered by the draft.

  • product: external identifier of the product referenced by the draft.

  • service: external identifier of the service referenced by the draft.

The following is an example response:

[
    {
        "orquestId": 2221111,
        "name": "JUNE-23",
        "creator": "username@gmail.com",
        "updater": "username@gmail.com",
        "created": "2025-05-25T15:53:27.031Z",
        "updated": "2025-05-25T15:53:27.031Z",
        "status": "PUBLISHED",
        "from": "2025-06-23",
        "to": "2025-06-29",
        "product": "0001-GENERAL",
        "service": "0001"
    },
    {
        "orquestId": 22221112,
        "name": "JUNE-23",
        "creator": "username@gmail.com",
        "updater": "username@gmail.com",
        "created": "2025-05-19T12:03:34.424Z",
        "updated": "2025-05-25T15:52:53.632Z",
        "status": "NONE",
        "from": "2025-06-23",
        "to": "2025-06-29",
        "product": "0001-GENERAL",
        "service": "0001"
    }
]

The default status when creating a new draft is NONE. However, when a draft that was generated by the engine (GENERATED) is manually modified, it reverts to the NONE status.

When published, a copy is created and assigned the PUBLISHED status. Because of this, as shown in the example, the same draft named JUNE-23 appears once with status NONE and once with status PUBLISHED.

Considerations

If there are no drafts for the requested date, the request will return an empty array [].

If the product specified in the URL does not exist within the business, the request will return a 404 Not Found error, with the message indicating not exists.

This request allows filtering the results by draft status. To do so, add the status parameter to the URL:

GET /api/v1/businesses/{businessId}/services/{serviceId}/drafts?day={yyyy-MM-dd}&status={STATUS}
Example
GET /api/v1/businesses/BUSINESSID/products/0001-GENERAL/drafts?day=2025-02-25&status=PUBLISHED

Response:

[
    {
        "orquestId": 2221111,
        "name": "JUNE-23",
        "creator": "username@gmail.com",
        "updater": "username@gmail.com",
        "created": "2025-05-25T15:53:27.031Z",
        "updated": "2025-05-25T15:53:27.031Z",
        "status": "PUBLISHED",
        "from": "2025-06-23",
        "to": "2025-06-29",
        "product": "0001-GENERAL",
        "service": "0001"
    }
]