Scheduling requests¶
Some resources support that requests are scheduled for later processing. This
is done by specifying the field schedule
in the request header. The value
should be an ISO-8601 compatible timestamp stating the earliest time the
request should be processed.
If the specified timestamp already has occurred, the call will proceed as usual. Otherwise HTTP status code 202 (Accepted) will be returned together with the CRLF-delimited triple (timestamp, request id, request URI).
For example, retrieving all metadata fields at a later time:
GET /metadata-fields HTTP/1.1
Schedule: 2010-07-02T11:55:00+02:00
HTTP/1.1 202 Accepted
2010-07-02T11:55:00+02:00 802972 http://localhost:8080/API/scheduled-request/802972
States of scheduled requests¶
There are four states that a scheduled request can be in.
- WAITING
- The request has been scheduled and is waiting to be processed.
- SUCCESS
- The request has been processed successfully, by receiving status code 200 (OK).
- CONNECTION_FAILURE
- The request has been processed, but failed for unknown reasons.
- BAD_REQUEST
- The request has been processed, but received an unexpected status code.
Managing scheduled requests¶
Listing all scheduled requests¶
-
GET
/scheduled-request
¶ Retrieves all known scheduled requests for the current user.
Query Parameters: - state – An optional parameter to retrieve requests belonging to a certain state.
Produces: - application/xml, application/json – ScheduledRequestListDocument
Example¶
GET /scheduled-request?state=SUCCESS
<ScheduledRequestListDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<scheduledRequest>
<id>802972</id>
<user>admin</user>
<state>SUCCESS</state>
<date>2010-07-02T11:55:00.000+02:00</date>
<created>2010-07-02T11:54:16.161+02:00</created>
<executed>2010-07-02T11:55:36.762+02:00</executed>
<request>
<uri>http://localhost:8080/API/metadata-field</uri>
<method>GET</method>
</request>
<response>
<statusCode>200</statusCode>
<hasBody>true</hasBody>
<contentType>application/xml</contentType>
</response>
</scheduledRequest>
</ScheduledRequestListDocument>
Retrieving a specific request¶
-
GET
/scheduled-request/
(request-id)¶ Retrieves the request that matches the specified id.
Produces: - application/xml, application/json – ScheduledRequestDocument
Example¶
GET /scheduled-request/802972
<ScheduledRequestDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<id>802972</id>
<user>admin</user>
<state>SUCCESS</state>
<date>2010-07-02T11:55:00.000+02:00</date>
<created>2010-07-02T11:54:16.161+02:00</created>
<executed>2010-07-02T11:55:36.762+02:00</executed>
<request>
<uri>http://localhost:8080/API/metadata-field</uri>
<method>GET</method>
</request>
<response>
<statusCode>200</statusCode>
<hasBody>true</hasBody>
<contentType>application/xml</contentType>
</response>
</ScheduledRequestDocument>
Retrieving the response body¶
-
GET
/scheduled-request/
(request-id)/response
¶ Retrieves the response body of the scheduled request. This can only be called if the state of the request is either SUCCESS or BAD_REQUEST. The content-type is the same that was returned when the request was processed.
Produces: - */* – The response body.
Example¶
GET /scheduled-request/802972/response
<MetadataFieldListDocument xmlns="http://xml.vidispine.com/schema/vidispine">
<field system="true">
<name>durationTimeCode</name>
<type>string-noindex</type>
</field>
<field system="true">
<name>mimeType</name>
<type>string-exact</type>
</field>
...
</MetadataFieldListDocument>
Deleting all requests¶
-
DELETE
/scheduled-request/
¶ Deletes all scheduled requests for the current user.
Deleting a specific request¶
-
DELETE
/scheduled-request/
(request-id)¶ Deletes the scheduled request with the specified id.