By default, all REST API requests are synchronous, which means that the client/server connection stays open until the request completes and the response is returned.
Alternatively, you can make any active management request (one that changes the system rather than just querying it) into an asynchronous request by appending a timeout parameter to the HTTP request header. Asynchronous requests are more reliable than synchronous requests. With an asynchronous request, you start a job, and the server returns an associated job resource instance almost immediately, if you use timeout=0. You can query the
job resource instance when convenient to get the HTTP response code and response body for the request. If you create a synchronous request and the network connection is lost, or the REST client or server goes down while the request is processing, there is no way to obtain the request status.
Syntax
As the first parameter on the request URI:
?timeout=<seconds>
As a subsequent parameter on the request URI:
&timeout=<seconds>
Usage
The following considerations apply to asynchronous requests:
A valid asynchronous request returns a
202 Accepted HTTP status code and a minimal
job resource instance in the response body.
Depending on the type of error, an invalid asynchronous request can either return immediately or return after the timeout with the appropriate error code in the response header and a message entity in the response body.
To view the status of an asynchronous request, retrieve data for the appropriate
job resource instance. For example, if an asynchronous modify user request returns a
job resource instance with an ID of N-67, you can use an instance query to retrieve the asynchronous request data from this
job resource.
Example 1: Creating an asynchronous request
The following example uses the timeout request parameter on a request to modify a
user instance.