访问ServiceM8中已填写的表单字段 [英] Access completed form fields in ServiceM8

查看:82
本文介绍了访问ServiceM8中已填写的表单字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试访问ServiceM8中完整的表单字段数据,包括上载的图像. api参考未详细说明如何访问它们.谁能提供示例或文档?

I am trying to access completed form field data in ServiceM8 including uploaded images. The api reference does not detail how to access them. Can anyone provide an example or documentation?

推荐答案

它没有公开记录,但是您可以通过FormResponses端点访问完成的表单.

It's not publicly documented, but you can access completed forms via the FormResponses endpoint.

https://api.servicem8.com/api_1.0/FormResponse.json

[{
  "edit_date": "2015-02-17 11:12:22",
  "active": 1,
  "form_uuid": "578344cc-8d57-441b-a713-02207430f7cb",
  "staff_uuid": "",
  "regarding_object": "job",
  "regarding_object_uuid": "8b9bfe73-c43c-4275-bb4e-1aac9b6f8adb",
  "field_data": "removed (see below)",
  "timestamp": "2015-02-17 11:12:20",
  "form_by_staff_uuid": "0e72af0f-22db-4ddb-ac7d-eba2c1ef2d4b",
  "document_attachment_uuid": "6b73bfa3-3dd8-48b7-83b2-af1dcc78262b",
  "uuid": "ff1926c8-8879-41a5-9f2d-e4e4455e92eb"
}]

问题的实际答案在field_data属性中,该属性本身是JSON编码的字符串.这是一个示例:

The actual responses to the questions are in the field_data property, which is itself a JSON-encoded string. Here's an example:

[
  {
    "UUID": "1ea64222-2b0e-4dc4-a99b-698603a9f59b",
    "FieldType": "Date",
    "Response": "Tue Feb 17 2015 00:00:00 GMT+0930 (ACST)",
    "SortOrder": 1,
    "Question": "Date"
  },
  {
    "UUID": "9b4ea087-d154-4fb7-831e-c17cb882157b",
    "FieldType": "Multiple Choice",
    "Response": "Blah",
    "SortOrder": 2,
    "Question": "Supplier"
  },
  {
    "UUID": "24fdd846-8fc8-4ddf-9d58-6c5fa1b5310b",
    "FieldType": "Text",
    "Response": "1",
    "SortOrder": 3,
    "Question": "Part 1 Qty"
  },
  {
    "UUID": "6162749f-5945-455c-95ca-ca31e9bd6a7b",
    "FieldType": "Text",
    "Response": "p1",
    "SortOrder": 4,
    "Question": "Item Part No. 1"
  },
  {
    "UUID": "fd5c8f67-c68d-4dcb-96a7-05341fbb3dab",
    "FieldType": "Text",
    "Response": "part one",
    "SortOrder": 5,
    "Question": "Item Name 1"
  },
  {
    "UUID": "6e591103-78d4-42a0-8657-5229b5b469fb",
    "FieldType": "Photo",
    "Response": "cf91bae2-b9da-42e2-87ee-b416109bb44b",
    "SortOrder": 14,
    "Question": "Take Photo of Items 1"
  },
  {
    "UUID": "c8719af5-b550-40cf-9d83-0ea67ab30e5b",
    "FieldType": "Signature",
    "Response": "90ac5b56-fc0e-4a3a-8935-f43cdd23c05b",
    "SortOrder": 17,
    "Question": "Signature"
  }
]

对于照片问题(FieldType ==照片),响应"属性包含一个UUID,您可以从

For photo questions (FieldType == Photo), the Response property contains a UUID which you can retrieve from the Attachments endpoint.

附件的JSON数据:https://api.servicem8.com/api_1.0/Attachment/cf91bae2-b9da-42e2-87ee-b416109bb44b.json

JSON data for the attachment: https://api.servicem8.com/api_1.0/Attachment/cf91bae2-b9da-42e2-87ee-b416109bb44b.json

文件数据(即附件本身):https://api.servicem8.com/api_1.0/Attachment/cf91bae2-b9da-42e2-87ee-b416109bb44b.file

File data (i.e. the attachment itself): https://api.servicem8.com/api_1.0/Attachment/cf91bae2-b9da-42e2-87ee-b416109bb44b.file

这篇关于访问ServiceM8中已填写的表单字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆