API documentation

v1.0

Expense files

Store expense files in our system and access them at any time.

The process of uploading a file and associating it to an expense requires 3 operations to be performed in order: Create a signed url to upload an expense, upload a file to the storage system and associate a file to an expense. These operations can be limited to a defined time.

Create a signed url to upload an expense

This endpoint allows the generation of a temporary url to upload a file.

HTTP Request

GET/expenses/{id}/file/signed-url

201 Response

{
    "data": {
        "uuid": "3a09d77a-f547-48a7-ab9c-16fd72fc8e90",
        "signed_url": "https://bucket.orzame.com/orzame/t0/expenses/api/0_3a09d77a-f547-48a7-ab9c-16fd72fc8e90.tmp?x-amz-acl=private&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=admin%2F20220829%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220829T164623Z&X-Amz-SignedHeaders=host%3Bx-amz-acl&X-Amz-Expires=600&X-Amz-Signature=a7d8aaea8e6c8f04bddc58ea88c678cca1474c7ab78f9f388b48cc0182a79c1c",
        "expires_in": 600
    }
}

Upload a file to the storage system

Through the temporary url (`signed_url´) obtained in the previous endpoint, you can send your file in the request as `Binary File´. Once sent you must associate the expense to the file as specified in the following endpoint.

HTTP Request

PUT{signed_url}

200 Response

Response without body.

Associate a file to an expense

Once uploaded the file, this endpoint allows to associate the file to the expense.

If an new file is associated to an expense that already has associated one, the current will be deleted, expenses can only have associated one file.

HTTP Request

POST/expenses/{id}/file

Parameters

NameTypeDescription
nameString / RequiredFile name
uuidUnique identifier / Required`uuid´ key of the signed url response

204 Response

Response without body.

Create an url to access the file

This endpoint allows to create a temporary url to download or access the file.

HTTP Request

GET/expenses/{id}/file

201 Response

{
    "data": {
        "url": "https://bucket.orzame.com/orzame/t0/expenses/api/0_3a09d77a-f547-48a7-ab9c-16fd72fc8e90_invoice.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=admin%2F20220829%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220829T173740Z&X-Amz-SignedHeaders=host&X-Amz-Expires=600&X-Amz-Signature=77872cb27352655388dee11263586027db64087f6de2c13bfb585be0e4e9cf9d",
        "expires_in": 600,
        "name": "invoice.pdf",
        "content_type": "application\/pdf"
    }
}

Delete an expense file

This endpoint allows the deletion of an expense file from your application.

HTTP Request

DELETE/expenses/{id}/file

204 Response

Response without body.