5.3 Query-Plan Endpoint

The query-plan endpoint is used to check the state of a previously submitted planning optimisation task. It returns a short description of the task’s current progress or the best solution found so far.

5.3.1 Query-Plan Requests

A query-plan request takes the form of an HTTP GET request to a URL of the following form:

https://server-name/mwo/v2/query-plan/task-identifier?parameters

where server-name will be provided by Opturion, task-identifier is the task identifier returned by a successful call to the submit-plan service and parameters is described below.

5.3.2 Query-Plan Request Parameters

The query-plan endpoint accepts one optional parameter. It is:

  1. what – this should be one of “progress” or “solution”. If this parameter is not present then it defaults to “progress”.

5.3.3 Query-Plan Request Example

Here is an example query-plan request URL:

    https://demo.opturion.com/mwo/v2/query-plan/9046b6e9-7d7d-4453-a935-d331edb268bb

5.3.4 Query-Plan Responses

The following table lists of all of the HTTP status codes that query-plan specifically returns and their meaning. Any other HTTP status code returned by query-plan that is not covered by this table has its usual meaning.

Status Code

Description

Response Body

200 (OK)

Task status information has been returned.

For “progress” queries a JSON plan query response object describing the current progress. For “solution” queries a plan fetch response object if a solution has been found or empty otherwise.

401 (Unauthorized)

Authentication (if enabled) failed; the user is not authorized to access the optimiser.

Empty.

404 (Not Found)

A task matching the given task identifier and owned by the authenticated user could not be found.

Empty.

429 (Too Many Requests)

May be returned if rate limiting has been applied by the server.

Empty.

500 (Internal Server Error)

Indicates that an error occurred on the server.

The body may contain a JSON object further describing the error.

Note that in the case where rate limiting has been applied, clients should wait and then query the task status again at a later time.

In order to avoid rate limiting, it is recommended that clients leave at least 500 milliseconds or more between consecutive query-plan requests.