GET /api/attachments/:id/image
Return attachment image

Returns an attachment image, either an unprocessed or a processed one


PUT /api/attachments/:id
Rotate image

Update an existing image by changing its rotation angle

Params

Param name Description
attachment
required

Validations:

  • Must be a Hash

attachment[transaction_id]
required

Receipt ID

Validations:

  • Must be a Integer

attachment[rotate_angle]
optional

How many degrees to rotate an image to; may be either positive or negative number, e.g. 30, -90

Validations:

  • Must be a Integer


POST /api/attachments
Upload new image

Upload new attachment either to an existing receipt or initiate creating a new receipt.

An example of creating a new draft transaction and adding an attachment via curl:

curl -X POST -F "file=@/home/buru/Pictures/crycat.png" -F "draft=1" https://app.bezala.com/api/attachments?token=helloworld

Response:

{"id":1091,"file":"/uploads/tmp/1622055993-1726493-0003-4122/crycat.png","transaction_id":2804}

Params

Param name Description
file
required

Either a single FILE object or a hash with one or more files for upload, e.g. {“0”: FILE1, “1”: FILE2}

Validations:

  • Must be a Hash

transaction_id
optional

Receipt id in case attachment is being added to existing receipt. Warning: optional only if “draft” param is set to 1

Validations:

  • Must be a Integer

draft
optional

If equal to 1, attachment can be saved without a transaction_id

Validations:

  • Must be a Integer


DELETE /api/attachments/:id
Delete image

Params

Param name Description
id
required

Attachment ID

Validations:

  • Must be a Integer


PUT /api/attachments
Sort images

Update images display order

Examples

{
  "attachment": ["395", "397", "396"]
}
    

Params

Param name Description
attachment
optional

Array of attachment ids in the desired order

Validations:

  • Must be an array of Integer