如何通过API获取ServiceM8附件下载链接/文件数据

时间:2017-02-24 18:31:13

标签: api

在提交表格的服务M8中,我可以附加图像,并将其保存为附件。我可以通过API和webhook获取该图像的附件ID。现在我想通过电子邮件发送这张照片。

如何从Attachment对象获取文件链接/文件数据。

以下是附件API响应示例

{
  "uuid": "0c7b6f95-fcb7-483d-8805-9e3547f6d31a",
  "edit_date": "2017-01-12 10:59:01",
  "active": 1,
  "attachment_name": "Photo",
  "file_type": ".jpg",
  "attachment_source": "PHOTO",
  "lng": 0,
  "lat": 0,
  "tags": "",
  "created_by_staff_uuid": "c0b476c2-d5b5-4e21-96a9-7088689e778b",
  "timestamp": "2017-01-12 10:58:59",
  "related_object": "formresponse",
  "related_object_uuid": "340a5289-79ff-4583-b7eb-7ed2680b81ba"
}

1 个答案:

答案 0 :(得分:0)

.file添加到URI的末尾:

而不是这样说:

  •  https://api.servicem8.com/api_1.0/Attachment/0c7b6f95-fcb7-483d-8805-9e3547f6d31a

请致电:

  • https://api.servicem8.com/api_1.0/Attachment/0c7b6f95-fcb7-483d-8805-9e3547f6d31a.file

哪个会返回一个如下所示的链接:

  • https://data-cdn.servicem8.com/attachments/servicem8_xxxxxx/dbo_uuid.ext?expires..etc.

您的案例中的{p> .extjpg,但PDF会返回.pdf