5.2 Submit-Plan Endpoint

The submit-plan endpoint is used to submit planning optimisation tasks to the optimiser.

5.2.1 Submit-Plan Requests

A submit-plan request is an HTTP POST request to a URL of the following form:

https://server-name/mwo/v2/submit-plan

where server-name will be provided by Opturion.

The body of the POST request is a JSON document containing a plan request object.

5.2.2 Submit-Plan Request Example

Here is an example URL for a submit-plan request:

    https://demo.opturion.com/mwo/v2/submit-plan

On success (see below), a submit-plan request will return with HTTP status code 202 (ACCEPTED) and the response body will contain a JSON encoded plan submit response object. This object will contain the newly assigned task identifier. The task identifier can be used with the query-plan endpoint to examine the current state of the job.

Here is an example of a plan submit response object:

    {
      "status": "OK",
      "task_id": "40a56579-bc85-4f26-aa37-d83332815b2d"
    }

5.2.3 Submit-Plan Responses

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

Status Code

Description

Response Body

202 (Accepted)

Task has been accepted and scheduled to run.

A JSON plan submit response object giving the task identifier for the newly accepted job.

400 (Bad Request)

Errors encountered in input data.

A JSON plan submit response object describing the errors.

401 (Unauthorized)

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

Empty.

429 (Too Many Requests)

Rate limiting has been applied by the server.

Empty.

500 (Internal Server Error)

An error occurred on the server.

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

Note that in the case where rate limiting has been applied, clients should wait and then re-submit the optimisation task at a later time.