Order Endpoints

Below are specific endpoint description you may use with orders within SiteFlow:

Validate Order

This endpoint validates an order structure and returns whether it is suitable for submission or not.

HTTP Request

POST https://pro-api.oneflowcloud.com/api/order/validate

The body of the request should be the order structure in JSON format.

Create Order

This endpoint submits an order into OneFlow for immediate processing.

HTTP Request

POST https://orders.oneflow.io/api/order

The body of the request should be the order structure in JSON format.

HTTP Response

Submission process

The submission request will be stored in a persistent storage location and will be processed asynchronously.

Response

The response to the caller will happen right after the order request has been stored correctly. This response will be shown, regardless of whether the order is valid or not. The response body will include the following fields:

{
     "_id": "5910757 faab8ec6f60127999",
     "url": "https://s3.amazonaws.com/order/5910757faab8ec6f60127999",
     "timestamp": "2017-04-08T13:41:19.998Z",
     "sourceAccountId": "51 bb2fc71745777ba63f3f11"
}
Field Description
_id The order identifier. The system will keep this identifier and will save it within the new order
url Url to the stored original order content
timestamp Date and time of the order submission request
sourceAccountId Requester’s account id

The new API is designed to scale up and down depending on the current demand. The API will limit the number of request it accepts during the time it is scaling up. This will require the requesters to handle the possible 5XX responses trying to resubmit the request after a few seconds, the time the system requires to finish the provision of new instances.

Get All Orders

This endpoint retrieves all orders (by page). They are sorted by most recent first.

HTTP Request

GET https://pro-api.oneflowcloud.com/api/order?page=2&pagesize=3

Query Parameters

Parameter Default Description
pagesize 10 Optional. The size of the page (number of orders) to return
page 1 Optional. Which page to return

Get an Order

This endpoint retrieves a specific order.

HTTP Request

GET https://pro-api.oneflowcloud.com/api/order/<ID>

HTTP Response

If the order was found, the response body is existing order (in JSON format).

URL Parameters

Parameter Description
ID The ID of the order to retrieve (will be a 24-character hex string)

Cancel an Order (by source ID)

This endpoint allows you to cancel a specific order, using the source account name and ID.

HTTP Request

PUT https://pro-api.oneflowcloud.com/api/order/<sourceAccountName>/<sourceOrderId>/cancel

No request body is necessary.

HTTP Response

If the order was found and wasn’t already cancelled, the response body is the cancelled order (in JSON format).

URL Parameters

Parameter Description
sourceAccountName The name of the source account that the order originated from
sourceOrderId The source order ID, specified when the order was submitted

Get an Order (by source ID)

This endpoint allows you to get a specific order, using the source ID.

HTTP Request

GET https://pro-api.oneflowcloud.com/api/order/bysourceid/<sourceOrderId>

No request body is necessary.

HTTP Response

If the order was found, the response body is the order with the source order id (in JSON format).

URL Parameters

Parameter Description
sourceOrderId The source order ID, specified when the order was submitted