Skip to content

Asynchronous requests

Some Ubstream API endpoints will return a Status Code 202 (Accepted) with a requestId property in response data:

{
    "requestId": "d9679d87-f074-4da0-9528-99ce2c7bc799"
}

These endpoints are all corresponding to asynchronous operations that can take more or less time to be completed.

The requestId property can be used to retrieve the operation status.

To check an operation status we need to send a POST request to the status endpoint.

POST /v1/requests/{REQUEST_ID}/status HTTP/1.1
Host: developer.ubstream.com
Content-Type: application/json

cURL example:

curl -X GET "https://developer.ubstream.com/api/v1/requests/{REQUEST_ID}/status" -H  "accept: application/json" -H  "Authorization: {BEARER_TOKEN}"

The response will have a Status Code 200 (OK) and contain the following attributes as JSON format:

{
  "status": "completed"
}

Possible status are:

  • completed: The operation ended successfully.
  • failed: The operation ended with failures.
  • pending: The operation is still running.

Note: Consumers SHOULD use polling mechanism to inspect every asynchronous operation's termination.