Attachments
Attachments are files which belong to a Contact or Property.
Object Definition
| Field | Type | Description |
|---|---|---|
uuid | string | Unique identifier for the object |
created_at | string | ISO 8601 datetime when the attachment was originally created |
updated_at | string | ISO 8601 datetime when the attachment was last updated |
name | string | Filename of the attachment |
description | string / null | Description of what the attachment is |
size | integer | Size of the file in bytes |
download_url | string | URL the user can access to download the attachment |
stream_url | string | URL the user can access to view the attachment in the browser (If their browser supports it) |
mime_type | string | Mime type of the attachment |
type | string | Human readable file type (Document, Image, Video or Audio) |
List all Attachments
Retrieve a paginated list of all the accounts Attachments. GET /attachments.
Filters
You may filter the results from the list endpoint using the following query parameters
| Field | Type | Description |
|---|---|---|
uuid | string | Exact match for the attachment's uuid |
contact | Relational Filter | Filter using contact attributes |
property | Relational Filter | Filter using property attributes |
Example Response
{
"data": [
{
"uuid": "97b28627-d690-40f6-988e-018b28e5cf3e",
"created_at": "2018-08-02T13:01:09+01:00",
"updated_at": "2018-08-02T13:01:13+01:00",
"name": "example.pdf",
"description": null,
"size": 500000,
"download_url": "https://my.propertydeck.com/attachments/97b28627-d690-40f6-988e-018b28e5cf3e/download",
"stream_url": "https://my.propertydeck.com/attachments/97b28627-d690-40f6-988e-018b28e5cf3e/stream",
"mime_type": "application/pdf",
"type": "Document"
}
],
"meta": {
"pagination": {
"total": 1,
"count": 1,
"per_page": 10,
"current_page": 1,
"total_pages": 1
}
}
}
Get a single Attachment
Retrieve a single attachment by it's uuid. GET /attachments/:uuid.
Example Response
{
"data": {
"uuid": "97b28627-d690-40f6-988e-018b28e5cf3e",
"created_at": "2018-08-02T13:01:09+01:00",
"updated_at": "2018-08-02T13:01:13+01:00",
"name": "example.pdf",
"description": null,
"size": 500000,
"download_url": "https://my.propertydeck.com/attachments/97b28627-d690-40f6-988e-018b28e5cf3e/download",
"stream_url": "https://my.propertydeck.com/attachments/97b28627-d690-40f6-988e-018b28e5cf3e/stream",
"mime_type": "application/pdf",
"type": "Document"
}
}
Creating an Attachment
There are two endpoints for creating an attachment, depending if you want to associate it with a Contact or Property. Perform a POST request to any of the following endpoints, they return a HTTP 201 status code on success.
Your Content-Type header for this request must be set to multipart/form-data
/properties/:uuid/attachments/contacts/:uuid/attachments
Input
| Field | Type | Description |
|---|---|---|
upload | string | Contents of the file |
description | string / null | Description of the file contents |
Updating an Attachment
Perform a PUT request to the /attachments/:uuid endpoint. This endpoint will return a HTTP 200 status code on success.
Input
| Field | Type | Description |
|---|---|---|
description | string / null | Description of the file contents |
Deleting an Attachment
Perform a DELETE request to the /attachments/:uuid endpoint. This endpoint will return a HTTP 204 status code on success.
