GET Representation of Asynchronous Request

View how an asynchronous request made to the server is represented

Description

Use a GET method to view the representation of an asynchronous request on the server. The URI of the self field serves as the addressable resource for the method.

Request

HTTP Method

GET

URI

http://host:port/{request-uri-string}

Response

Success

HTTP Status Code

200 OK

Body

NameDescriptionValue-Type
idID of a particular request.{id-string}
selfURI of particular request.{request-uri-string}
upURI of a collection of requests tied to a particular client.{request-collection-uri-string}
lastModifiedSeqNumber indicating when a request represented by self was last modified.{server-state-number}
stateState of a request.{request-state-string}

Possible states:

READING
IN_QUEUE
PROCESSING
READY
ERROR
CANCELLED

clientClient id or name that was specified as a query parameter while initiating an asynchronous request.{client-id-string}

Example:

{
  "id": "f90c2ff8-4d27-4795-806d-18c351abeb5b",
  "self": "/~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests/f90c2ff8-4d27-4795-806d-18c351abeb5b",
  "up": "/~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests",
  "lastModifiedSeq": 30,
  "state": "READING",
  "client": "786"
}

Error

HTTP Status Code

400 NoMatchForQueryParams

404 ResourceNotFound

Sample Call

HTTP

Request:

GET /~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests/f90c2ff8-4d27-4795-806d-18c351abeb5b HTTP/1.1
Host: localhost:9910

Response:

Status Code: 200 OK
{
  "id": "f90c2ff8-4d27-4795-806d-18c351abeb5b",
  "self": "/~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests/f90c2ff8-4d27-4795-806d-18c351abeb5b",
  "up": "/~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests",
  "lastModifiedSeq": 31,
  "state": "IN_QUEUE",
  "client": "786"
}

JavaScript

var data = null;
var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
    if (this.readyState === 4) {
        console.log(this.responseText);
    }
});
xhr.open("GET", "http://localhost:9910/~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests/f90c2ff8-4d27-4795-806d-18c351abeb5b");
xhr.send(data);

Introduced in R2016b

Was this topic helpful?