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: 1ea06746dcf5c0aa981c40a339a61a092aa16df3cfa9b9aa12d216efcf158de4$$y1pq5sX+/inwnJZypa0ZDykWjNfxFSXzDsG95CYdUoR8JOvz621oWY2W5Q==--W+yS/SBn58UE0MC0--4tyJRTeQO0U32KkCaJeSSg==
Api-Key: TPMKnVsJp5AwZHMt

Body

{
  "scan": {
    "tag_list": [
      "foo",
      "bar"
    ],
    "attachments": [
      {
        "file_key": "ix5fagV1f1cRUMScnF6Bts9X",
        "thumbnail_key": "GsvruES4jzYkGyyyVt9DftRg",
        "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": "2020-06-01T21:44:46.856Z",
    "updated_at": "2020-06-01T21:44:46.856Z",
    "uid": "r9nTmj8K",
    "team_uid": "HGkVBbZP",
    "tag_list": [
      "foo",
      "bar"
    ],
    "attachments": [
      {
        "created_at": "2020-06-01T21:44:46.857Z",
        "updated_at": "2020-06-01T21:44:46.857Z",
        "publicly_visible": true,
        "publicly_downloadable": true,
        "metadata": {
          "foo": "bar"
        },
        "kind": "kind",
        "uid": "7TZbBGyL",
        "scan_uid": "r9nTmj8K",
        "file_key": "ix5fagV1f1cRUMScnF6Bts9X",
        "file_url": "http://localhost:3002/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBcVFCIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--e14d38af50c03f9f59d3f160e2509d38c4246b1a/test.json",
        "thumbnail_key": "GsvruES4jzYkGyyyVt9DftRg",
        "thumbnail_url": "http://localhost:3002/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBcU1CIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--d94fa6e043e8ee5d2f462724f0755b27514053af/test.json",
        "annotation_type_list": [

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