Skip to content
Bryan Hockey edited this page Jun 5, 2017 · 5 revisions

GET /v1/requests

Return a list of all requests. No pagination is provided at present.

Permissions

  • Admins can see all requests.
  • Users can only see their own.

Return codes

  • 200
  • 401

Body

[{
  "bag_id": "a5180fb4-c64e-4a85-8a2f-abe25b0a0c79",
  "user": "[email protected]",
  "content_type": "fake",
  "upload_link": "[email protected]:/vel/path",
  "mirlyn_id": "5f585466-318b-4fd9-a7d3-7e2839588c68",
  "created_at": "1969-12-31 18:00:00 -0600",
  "updated_at": "2017-05-17 18:49:08 -0500"
}]

GET /v1/requests/:bag_id

Return a specific request.

Permissions

  • Admins can see any requests.
  • Users can only see their own.

Return codes

  • 200
  • 403 - User wanted a request they do not own, and is not admin.
  • 404
  • 401

Body

{
  "bag_id": "a5180fb4-c64e-4a85-8a2f-abe25b0a0c79",
  "user": "[email protected]",
  "content_type": "fake",
  "upload_link": "[email protected]:/vel/path",
  "mirlyn_id": "5f585466-318b-4fd9-a7d3-7e2839588c68",
  "created_at": "1969-12-31 18:00:00 -0600",
  "updated_at": "2017-05-17 18:49:08 -0500"
}

POST /v1/requests

Create a new request

Permissions

  • Admins can specify the user.
  • Users cannot specify user (field is ignored).

Return codes

  • 201 - Will include Location header with full url to resource, /v1/requests/<bag_id>.
  • 303 - The result of a duplicate request. Includes Location header as with 201.
  • 401
  • 422 - Malformed post body

Body

None.

POST /v1/requests/:bag_id/complete

Notify the server that upload has completed for the request.

Permissions

  • Admins can post for any request.
  • Users can only post if they own the request at /v1/requests/:bag_id

Return codes

  • 201 - Will include Location header with full url to resource, e.g. /v1/queue/5
  • 303 - The result of a duplicate request. Includes Location header as with 201.
  • 401
  • 422 - Malformed post body

Body

None.

GET /v1/queue/:id

Return a specific queue item. While the task the queue item represents is still processing, its status will be "PENDING". Completed, successful tasks will have status "DONE", and will have a reference to the created bag. Unsuccessful tasks will have status "FAILED", and an array of errors.

Permissions

  • Admins can see any queue_item.
  • Users can only see their own.

Return codes

  • 200
  • 403 - User wanted a request they do not own, and is not admin.
  • 404
  • 401

Body

With 200 responses:

{
  "id": 1,
  "request": "/v1/requests/20d76061-b761-438f-a996-17893001fd34",
  "status": "PENDING",
  "created_at": "2017-05-18 00:03:04 UTC",
  "updated_at": "2017-05-18 00:03:04 UTC"
}
{
  "id": 2,
  "request": "/v1/requests/30d76061-b761-438f-a996-17893001fd35",
  "status": "DONE",
  "bag": "/v1/bags/30d76061-b761-438f-a996-17893001fd35"
  "created_at": "2017-05-18 00:03:04 UTC",
  "updated_at": "2017-05-18 00:03:04 UTC"
}
{
  "id": 3,
  "request": "/v1/requests/40d76061-b761-438f-a996-17893001fd36",
  "status": "FAILED",
  "error": [
    "error the first",
    "another error",
    "third error"
  ],
  "created_at": "2017-05-18 00:03:04 UTC",
  "updated_at": "2017-05-18 00:03:04 UTC"
}

With 303 responses:

None.

GET /v1/bags

Return a list of all bags. No pagination is provided at present. Additionally, the storage_location is only shown to admin users.

Permissions

  • Admins can see all bags.
  • Users can only see their own.

Return codes

  • 200
  • 401

Body

For admins:

[{
  "bag_id": "ea704c01-8cba-4497-bd4d-ca1d70119ec6",
  "user": "[email protected]",
  "content_type": "fake",
  "mirlyn_id": "4daccb0e-d30a-4d70-8494-393d8c55de5a",
  "storage_location": "excepturi/path",
  "created_at": "1969-12-31 18:00:00 -0600",
  "updated_at": "2017-05-17 19:07:42 -0500"
}]

For underpriviledged users:

[{
  "bag_id": "ea704c01-8cba-4497-bd4d-ca1d70119ec6",
  "user": "[email protected]",
  "content_type": "fake",
  "mirlyn_id": "4daccb0e-d30a-4d70-8494-393d8c55de5a",
  "created_at": "1969-12-31 18:00:00 -0600",
  "updated_at": "2017-05-17 19:07:42 -0500"
}]

GET /v1/bags/:bag_id

Return a specific bag. Additionally, storage_location is only shown to admin users.

Permissions

  • Admins can see any bag.
  • Users can only see their own.

Return codes

  • 200
  • 403 - User wanted a bag they do not own, and is not admin.
  • 404
  • 401

Body

For admins:

{
  "bag_id": "ea704c01-8cba-4497-bd4d-ca1d70119ec6",
  "user": "[email protected]",
  "content_type": "fake",
  "mirlyn_id": "4daccb0e-d30a-4d70-8494-393d8c55de5a",
  "storage_location": "excepturi/path",
  "created_at": "1969-12-31 18:00:00 -0600",
  "updated_at": "2017-05-17 19:07:42 -0500"
}

For underpriviledged users:

{
  "bag_id": "ea704c01-8cba-4497-bd4d-ca1d70119ec6",
  "user": "[email protected]",
  "content_type": "fake",
  "mirlyn_id": "4daccb0e-d30a-4d70-8494-393d8c55de5a",
  "created_at": "1969-12-31 18:00:00 -0600",
  "updated_at": "2017-05-17 19:07:42 -0500"
}