Tape Request Requests¶
-
class
nla_control.views.
RequestView
(**kwargs)¶ :rest-api
Requests to resources which put (PUT) a request for file retrieval from tape into the NLA system, get (GET) information about a single request and modify (POST) a single request.
-
get
(request, *args, **kwargs)¶ :rest-api
-
GET
/nla_control/api/v1/requests/req_id
¶ Get information about a single request.
- Parameters
req_id (integer) -- (optional) unique id for the request
- Response JSON Array of Objects
id (integer) -- unique id of the request
quota (string) -- the user id for the quota to use in making the request
retention (DateTime) -- date when restored files will be removed from restore area
request_date (DateTime) -- date when a request was made
request_patterns (string) -- pattern to match against to retrieve files from tape
notify_on_first_file (string) -- email address to notify when first restored file is available in the restore area
notify_on_last_file (string) -- email address to notify when last file is available in restore area - i.e. the request is complete
label (string) -- a user defined label for the request
storaged_request_start (string) -- (optional) the date and time the retrieval request started on StorageD
storaged_request_end (string) -- (optional) the date and time the retrieval request concluded on StorageD
first_files_on_disk (string) -- (optional) the date and time the first files arrived on the restore disk
last_files_on_disk (string) -- (optional) the date and time the last files arrived on the restore disk
files (List[string]) -- list of files in the request
- Status Codes
200 OK -- request completed successfully
404 Not Found -- request with req_id not found
Example request
GET /nla_control/api/v1/requests/225 HTTP/1.1 Host: nla.ceda.ac.uk Accept: application/json
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json [ { "files": [ "/neodc/sentinel1a/data/IW/L1_GRD/h/IPF_v2/2016/02/23/S1A_IW_GRDH_1SSV_20160223T132730_20160223T132755_010074_00ED60_3761.zip" ], "request_date": "2017-02-08T14:00:56.786661", "first_files_on_disk": "2017-02-08T14:01:49.652354", "quota": "dhk63261", "storaged_request_start": "2017-02-08T14:01:28.614195", "request_patterns": "/neodc/sentinel1a/data/IW/L1_GRD/h/IPF_v2/2016/02/23/S1A_IW_GRDH_1SSV_20160223T132730_20160223T132755_010074_00ED60_3761", "notify_on_last_file": null, "id": 225, "retention": "2017-03-10T00:00:00", "last_files_on_disk": "2017-02-08T14:01:49.679483", "notify_on_first_file": null, "label": "/neodc/sentinel1a/data/IW/L1_GRD/h/IPF_v2/2016/02/23/S1A_IW_GRDH_1SSV_20160223T132730_20160223T132755_010074_00ED60_3761", "storaged_request_end": "2017-02-08T14:01:49.679476" } ]
-
GET
/nla_control/api/v1/requests
¶ Get a list of all requests which have not passed their retention date.
- Response JSON Array of Objects
requests (List[Dictionary]) -- list of all requests submitted to the NLA system. Each dictionary contains:
id (integer): the id of the request
quota (string): the user who made the request
retention (DateTime): the date and time the request will expire on
request_date (DateTime): the date and time the request was made
label (string): the label assigned to the request by the user, or a default of the request pattern or first file in a listing request
- Status Codes
200 OK -- request completed successfully
Example request
GET /nla_control/api/v1/requests HTTP/1.1 Host: nla.ceda.ac.uk Accept: application/json
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json [ { "requests": [ { "label": "/neodc/sentinel1a/data/IW/L1_SLC/IPF_v2/2016/12/30/S1A_IW_SLC__1SDV_20161230T153351_20161230T153418_014611_017C04_9E83.zip", "retention": "2017-03-29T00:00:00", "id": 257, "request_date": "2017-02-27T12:58:02.398858", "quota": "jweiss" }, { "label": "/neodc/sentinel1a/data/IW/L1_SLC/IPF_v2/2015/04/16/S1A_IW_SLC__1SSV_20150416T135155_20150416T135225_005510_007092_F761.zip", "retention": "2017-03-29T00:00:00", "id": 262, "request_date": "2017-02-27T18:42:42.313259", "quota": "dcm39" }, { "label": "FTEP and UK", "retention": "2019-01-01T00:00:00", "id": 129, "request_date": "2016-12-02T12:15:35.975215", "quota": "ewilliamson01" } ] } ]
-
-
post
(request, *args, **kwargs)¶ :rest-api
-
POST
/nla_control/api/v1/requests
¶ Make a request to restore a file from tape.
- Request JSON Array of Objects
quota (string) -- the user id for the quota to use in making the request
patterns (string) -- (optional) pattern to match against to retrieve files from tape
files (string) -- (optional) list of files to retrieve from tape
retention (DateTime) -- (optional) date when restored files will be removed from restore area. Default is 5 days from when the request was made.
label (string) -- (optional) a user defined label for the request
notify_on_first_file (string) -- (optional) email address to notify when first restored file is available in the restore area
notify_on_last_file (string) -- (optional) email address to notify when last file is available in restore area - i.e. the request is complete
- Response JSON Object
req_id (integer) -- success, the unique identifier of the request
error_msg (string) -- error, a message detailing the error is returned
- Status Codes
200 OK -- request completed successfully
403 Forbidden -- error with user quota: either the user quota is full or the user could not be found
Example request
POST /nla_control/api/v1/requests HTTP/1.1 Host: nla.ceda.ac.uk Accept: application/json Content-Type: application/json [ { "patterns": "1986", "quota": "dhk63261", "retention": "2017-04-01" } ]
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json [ { "req_id": 23 } ] [ { "error": "Requested file(s) exceed user's quota" } ]
-
-
put
(request, *args, **kwargs)¶ :rest-api
-
PUT
/nla_control/api/v1/requests/req_id
¶ Update a request to restore a file from tape.
- Parameters
req_id (integer) -- unique id of request to update
- Request JSON Array of Objects
quota (string) -- the user id for the quota to use in making the request
retention (DateTime) -- (optional) date when restored files will be removed from restore area. Default is 5 days from when the request was made.
label (string) -- (optional) a user defined label for the request
notify_on_first_file (string) -- (optional) email address to notify when first restored file is available in the restore area
notify_on_last_file (string) -- (optional) email address to notify when last file is available in restore area - i.e. the request is complete
- Status Codes
200 OK -- request completed successfully
403 Forbidden -- user id could not be found: they have no associated quota
404 Not Found -- request with req_id could not be found
Example request
PUT /nla_control/api/v1/requests/23 HTTP/1.1 Host: nla.ceda.ac.uk Accept: application/json Content-Type: application/json [ { "label": "Test request for 1986 data", "quota": "dhk63261", "retention": "2017-04-01", "notify_on_first_file": "neil.massey@stfc.ac.uk" } ]
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json [ { "req_id": 23 } ] [ { "error": "No quota for user dhk8934" } ]
-
-