Main Content

GET Collection of Requests

View a collection of requests

Description

Use a GET method to view a collection of requests on the server. The URI of the up field serves as the addressable resource for the method.

The following sections use JSON as the data serialization format. For an example that shows how to use protobuf as the data serialization format with the Java® client API, see View the Collection of Requests Owned by a Particular Client.

Request

HTTP Method

GET

URI

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

Query Parameters

NameDescriptionValue-Type
since

Required.

{server-state-number}
clients

Required if ids is not specified.

{client-id-string_1},{client-id-string_2},...
ids

Required if clients is not specified.

{id-string_1},{id_string_2},...

Example:

?since=30&clients=786

  • The query parameter since={server-state-number} is required if you are making an asynchronous request.

  • The query parameter clients={client-id-string} is optional.

Response

Success

HTTP Status Code

200 OK

Body

NameDescriptionValue-Type
createdSeqNumber indicating the server state. The requests included in the data collection are the requests that have gone through some state change between since and createdSeq.{server-state-number}
dataCollection of MATLAB® execution requests that match a query.

"data": [
   {
   "id": {id-string},
   "self": [request-uri-string},
   "up": {request-collection-uri-string},
   "lastModifiedSeq": {server-state-number},
   "state": {request-state-string},
   "client": {client-id-string}
 },
{
   "id": {id-string},
   "self": {request-uri-string},
   "up": {request-collection-uri-string},
   "lastModifiedSeq": {server-state-number},
   "state": {request-state-string},
   "client": {client-id-string}
 },...
  ]

Example:

"data": [
    {
      "id": "c5666088-b087-4bae-aa7d-d8470e6e082d",
      "self": "/~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests/c5666088-b087-4bae-aa7d-d8470e6e082d",
      "up": "/~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests",
      "lastModifiedSeq": 19,
      "state": "READY",
      "client": "786"
    },
    {
      "id": "a4d0f902-d212-47d5-a855-6d64192842d8",
      "self": "/~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests/a4d0f902-d212-47d5-a855-6d64192842d8",
      "up": "/~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests",
      "lastModifiedSeq": 17,
      "state": "READY",
      "client": "786"
    },
    
  ]

Error

If you call a GET collection request for a nonexistent client, you receive a 404 error in response.

If you call a GET collection request for a client that currently has no requests (for example, all previous requests from the client were deleted), then the GET call either:

  • Times out if the client has a timeout limit specified.

  • Waits indefinitely until the client sends a new request. The GET call then returns that request.

HTTP Status Code

400 InvalidParamSince

400 MissingParamSince

400 MissingQueryParams

400 NoMatchForQueryParams

404 URL not found

500 InternalServerError

Sample Call

HTTP

Request:

GET /~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests?since=15&clients=786 HTTP/1.1
Host: localhost:9910

Response:

Status Code: 200 OK
{
  "createdSeq": 19,
  "data": [
    {
      "id": "c5666088-b087-4bae-aa7d-d8470e6e082d",
      "self": "/~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests/c5666088-b087-4bae-aa7d-d8470e6e082d",
      "up": "/~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests",
      "lastModifiedSeq": 19,
      "state": "READY",
      "client": "786"
    },
    {
      "id": "a4d0f902-d212-47d5-a855-6d64192842d8",
      "self": "/~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests/a4d0f902-d212-47d5-a855-6d64192842d8",
      "up": "/~e4a954fd-5eaf-4b54-aac2-20681b33d075/requests",
      "lastModifiedSeq": 17,
      "state": "READY",
      "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?since=15&clients=786");
xhr.send(data);

Version History

Introduced in R2016b