Create an Attachment

POST /attachments

The attachment resource connects uploads on Arta to shipment or request resources. Attached uploads are visible in the Arta Dashobard under the "Documents" tab on the shipment and request detail pages.

Each upload may be attached to many requests or shipments. Each request or shipment may have many associated uploads.

To create an attachment via the API you can must send an authenticated request to the POST /attachments endpoint with a body that includes one of two different payload schema.

To attach an upload to a shipment, the attachment payload must include upload_id and shipment_id attributes. This payload must not include a request_id attribute. For example:

{
    "attachment": {
        "shipment_id": "506d79b6-1e5e-4e8c-a266-74658fdaf4ee",
        "upload_id": 5285
    }
}

To attach an upload to a request, the attachment payload must include upload_id and request_id attributes. This payload must not include a shipment_id attribute. For example:

{
    "attachment": {
        "request_id": "506d79b6-1e5e-4e8c-a266-74658fdaf4ee",
        "upload_id": 5285
    }
}

Headers

  • Authorization string Required

    Authorize your API calls with an Arta API token

application/json

Body

  • attachment object Required
    Hide attachment attributes Show attachment attributes
    • upload_id integer Required

      The integer ID of the upload resource being attached

    • The string ID of the request resource being associated to an upload. Do not include a request_id in the attachment parameters if you are associating a shipment

    • The string ID of the shipment resource being associated to an upload. Do not include a shipment_id in the attachment parameters if you are associating a shipment

Responses

  • 201 application/json

    response

    Hide headers attributes Show headers attributes
    Hide response attributes Show response attributes object
    • request_id string | null

      The string ID of the request resource associated to an upload via this attachment. Null if this attachment associate a shipment

    • shipment_id string | null

      The string ID of the shipment resource associated to an upload via this attachment. Null if this attachment associate a request

    • id integer
    • upload_id integer Required

      The integer ID of the Upload resource associated with either a shipment or request via this attachment

  • 400 application/json

    Bad Request

    Hide response attribute Show response attribute object

    Basic Error

POST /attachments
curl \
 -X POST https://api.arta.io/attachments \
 -H "Content-Type: application/json" \
 -H "Authorization: ARTA_APIKey s0e1t2e3c4a5s6t7r8o9n10o11m12y" \
 -d '{"attachment":{"upload_id":4791,"request_id":"506d79b6-1e5e-4e8c-a266-74658fdaf4ee"}}'
Request example
{
  "attachment": {
    "upload_id": 4791,
    "request_id": "506d79b6-1e5e-4e8c-a266-74658fdaf4ee"
  }
}
Response examples (201)
{
  "id": 1942,
  "upload_id": 4791,
  "created_at": "2021-10-27T16:48:38.657228",
  "request_id": "506d79b6-1e5e-4e8c-a266-74658fdaf4ee",
  "updated_at": "2021-10-27T16:48:38.657228",
  "shipment_id": null
}
Response examples (400)
{
  "errors": {
    "detail": "string"
  }
}