Scans

POST /scans

Upon successful file upload via a POST to /direct_uploads, a scan record may be created by passing the key returned from each direct upload as either the file_key or thumbnail_key of each file to be associated with the scan.

Endpoint

POST /api/v2/scans

Parameters

Name Description type
scan[attachments][][file_key] required Direct upload file key string
scan[attachments][][thumbnail_key] Direct upload thumbnail key string
scan[attachments][][kind] Kind string
scan[tag_list] Array of tag strings array
scan[attachments][][metadata] File metadata json
scan[attachments][][publicly_downloadable] Publicly downloadable boolean
scan[attachments][][publicly_visible] Publicly visible boolean
scan[attachments] required Array of objects containing above parameters array

Request

Route

POST /api/v2/scans

Headers

Accept: application/json
Content-Type: application/json
Access-Token: 5eb7f762226f5d70f43b9db83202f702551cc32bc78a7a688319e3aed5ffff87$$dHTXzic8n5QYOsJtt9jDixT+RjYQzOmvQJVJRjeMADvRLE5rLV5XQl2hjQ==--flLEBp5V0rNe8py7--PxkuGFyXxkcY5xqlEDBCYg==
Api-Key: ZNhxAVmH5VHScyQz

Body

{
  "scan": {
    "tag_list": [
      "foo",
      "bar"
    ],
    "attachments": [
      {
        "file_key": "JbYPZacZWe9ygU4QerSZKmp2",
        "thumbnail_key": "cSwv5beZ35CbSYeCXtUtwytP",
        "kind": "kind",
        "publicly_downloadable": true,
        "publicly_visible": true,
        "metadata": {
          "foo": "bar"
        }
      }
    ]
  }
}

Response

Status

201

Headers

Content-Type: application/json; charset=utf-8

Body

{
  "scan": {
    "created_at": "2019-03-22T22:36:00.443Z",
    "updated_at": "2019-03-22T22:36:00.443Z",
    "uid": "ymBpymmA",
    "team_uid": "Jn8yTgps",
    "tag_list": [
      "foo",
      "bar"
    ],
    "attachments": [
      {
        "created_at": "2019-03-22T22:36:00.444Z",
        "updated_at": "2019-03-22T22:36:00.444Z",
        "publicly_visible": true,
        "publicly_downloadable": true,
        "metadata": {
          "foo": "bar"
        },
        "kind": "kind",
        "uid": "hdigoZqT",
        "scan_uid": "ymBpymmA",
        "file_key": "JbYPZacZWe9ygU4QerSZKmp2",
        "file_url": "http://localhost:3002/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBaHNCIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--f8a85d43afe2923af0acc77bd49eae7ed13c6d76/test.json",
        "thumbnail_key": "cSwv5beZ35CbSYeCXtUtwytP",
        "thumbnail_url": "http://localhost:3002/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBaG9CIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--e92f082a4bd7fdef2909c7d252086757145df822/test.json",
        "annotation_type_list": [

        ],
        "team_uid": "Jn8yTgps",
        "collection_uid": null
      }
    ]
  },
  "success": true
}