API call blueprint
The time to run a calculation using the OLI API cannot be predicted accurately and also some calculations may take longer to compute than others. Hence, a polling mechanism is required to retrieve the result of each calculation. The steps for this mechanism is described below.
Send a GET/POST request to the specific URL
If the request was successful(status:200), the JSON response back will contain a link to the results and status of the computation. The status can be IN QUEUE/IN PROGRESS
Keep polling the results link with a GET request until status of the response changes to PROCESSED/FAILED/ERROR
if status is PROCESSED, then response will also contain the result of the computation
Here is an example for an isothermal flash call
Isothermal flash [1st request]
POST
https://api.olisystems.com/engine/flash/{dbs_file_id}/isothermalFlash
The first request to initiate an isothermal flash calculation
Headers
Authorization
string
Bearer {access_token}
Content-Type
string
application/json
Response description
field
description
code
HTTP response status code
data.file_id
the dbs file reference identifier
data.jobId
the current request job identifier
data.resultsLink
the https endpoint to poll to get the final result
data.status
current status of the job
message
message describing the request
status
status of the current request, can be SUCCESS or FAILED
access_token in the request authorization header is obtained as shown here.
db_file_id is the id of the dbs file, you can obtain it here.
Result of computation [2nd request and onwards]
GET
https://api.olisystems.com/result/flash/{jobId}?context=engine
URL contains the result of the computation if status is processed
Headers
Authorization
string
Bearer {access_token}
Content-Type
string
application/json
status can be IN QUEUE, IN PROGRESS, PROCESSED, FAILED or ERROR
if status = IN QUEUE/IN PROGRESS, keep polling the endpoint in resultsLink
if status = PROCESSED, result should be in data.result
if status = FAILED, computation failure. error will be be in data.error
if status = ERROR, a system error occurred
Example chain of request responses
Presence of the data.result object signifies that results are available. if data.error object is present, then this means that the computation has failed
Last updated