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: 53f4e13c28ad500fb45477457edcc366e5b7afeff1d4d8f7072eaa717cd1b79e$$c68FhTJenWxiJQl7AiRddDBecrsRGlTudq+TFVxNT3Y5nzaeK3jQdwZ99g==--ust1/j4noAl0TSM5--zm0IgoBZNDSpT2UIiwf6/A==
Api-Key: kEjUQiCTGCTGs9rt

Body

{
  "scan": {
    "tag_list": [
      "foo",
      "bar"
    ],
    "attachments": [
      {
        "file_key": "7y1EwRPunFSmN2dZQxVULgo4",
        "thumbnail_key": "miUWUkQwxX4wR6UQX9QNHfUZ",
        "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-01-15T19:56:06.735Z",
    "updated_at": "2020-01-15T19:56:06.735Z",
    "uid": "eEfAVBqK",
    "team_uid": "SENF94UF",
    "tag_list": [
      "foo",
      "bar"
    ],
    "attachments": [
      {
        "created_at": "2020-01-15T19:56:06.736Z",
        "updated_at": "2020-01-15T19:56:06.736Z",
        "publicly_visible": true,
        "publicly_downloadable": true,
        "metadata": {
          "foo": "bar"
        },
        "kind": "kind",
        "uid": "3wHQzgbp",
        "scan_uid": "eEfAVBqK",
        "file_key": "7y1EwRPunFSmN2dZQxVULgo4",
        "file_url": "http://localhost:3002/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBdVVFIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--6da013665d634708f7be4f7455d2edda14e15be4/test.json",
        "thumbnail_key": "miUWUkQwxX4wR6UQX9QNHfUZ",
        "thumbnail_url": "http://localhost:3002/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBdVFFIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--b970ccd2b5dca0c8d77b830f3eab791c236a2a1d/test.json",
        "annotation_type_list": [

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