Discussions

Ask a Question
Back to All

Attachments added via API

Following this API guide:

https://developer.servicem8.com/reference/post-attachment-create

I am trying to add an attachment to a job like this payload:

{
"active": 1,
"related_object": "Job",
"related_object_uuid": "9adf3227-b675-4a26-90fa-20404e82142b",
"file_type": ".png",
"attachment_source": "https://maps.googleapis.com/maps/api/staticmap?center=-42.09278384,171.34470269&markers=-42.09278384,171.34470269&zoom=15&size=500x500&key=AIzaSyD3WoeCO2fiT-AaM8eebNvNBRsO4nGCjDE&maptype=roadmap",
"photo_width": "500",
"photo_height": "500",
"attachment_name": "Map"
}

Then when I query the list of attachments is shows "active": 0:

{
"uuid": "f8d61167-1b0d-438a-91da-204042377e3b",
"edit_date": "2023-08-10 14:38:19",
"active": 0,
"attachment_name": "Map",
"file_type": ".png",
"photo_width": "500",
"photo_height": "500",
"attachment_source": "https//maps.googleapis.com/maps/api/staticmap?center=-42.09278384,171.34470269&markers=-42.09278384,171.34470269&zoom=15&size=500x500&key=AIzaSyD3WoeCO2fiT-AaM8eebNvNBRsO4nGCjDE&maptype=roadmap",
"lng": 0,
"lat": 0,
"tags": "",
"extracted_info": "",
"created_by_staff_uuid": "5c2d82fd-e11a-4108-8e91-203dae07cedb",
"timestamp": "2023-08-10 14:38:19",
"related_object": "job",
"related_object_uuid": "9adf3227-b675-4a26-90fa-20404e82142b"
}

Trying to update the parameter does nothing:

curl --request POST
--url https://api.servicem8.com/api_1.0/attachment/f8d61167-1b0d-438a-91da-204042377e3b.json
--header 'accept: application/json'
--header 'authorization: Basic ...'
--header 'content-type: application/json'
--data '{"active":1}'