【问题标题】:Survey Monkey- Custom Values via API v3调查猴子 - 通过 API v3 自定义值
【发布时间】:2017-07-21 04:20:09
【问题描述】:

我目前无法弄清楚如何通过 API 获取多个自定义字段。 Excel 提取提供了我需要的列,但我找不到 v3 GET 或 POST 协议来获取所需的字段。

来自: api.surveymonkey.net/v3/surveys/[survey_id]/details

我看到了所需的字段:

  1. custom_variables.a = [变量列名]
  2. custom_variables.b = [变量 b 列名]

使用以下内容:api.surveymonkey.net/v3/surveys/[survey_id]/responses/bulk?page=[#]&per_page=[#]

  1. data.0.custom_value = 空白
  2. data.0.recipient_id = 空白

10/6/16 更新:更改自定义变量计划要求

变更说明:让 Gold 计划及更高版本可以访问调查自定义变量。

受影响的端点:/surveys、/surveys/{id}、/surveys/{id}/responses/bulk、/collectors/{id}/responses/bulk、/surveys/{id }/responses/{id}、/collectors/{id}/responses/{id}、/surveys/{id}/responses/{id}/details、/collectors/{id}/responses/{id}/details

我达到了 API 调用限制,但还不能运行 /collectors/{id}/responses。我认为最好现在就问并得到正确的答案(这样我就可以完成这个项目并在我的“计数器”重置时达到我的截止日期)。作为信息,我正在使用 Alteryx 拨打电话,一旦我完成了这篇文章,将在 Alteryx 网站上发布工作流程(以回馈社区)。

提前感谢您的帮助!

-画了

【问题讨论】:

    标签: api surveymonkey alteryx


    【解决方案1】:

    所以这是两种不同的“自定义值”。

    Custom Variables 基本上是 URL 参数,将被接受并与调查响应一起存储。这些仅适用于非基于电子邮件的收集器,尤其是 Weblink 收集器。自定义变量也存储在调查表中,因此当您 fetch 使用

    GET /v3/surveys/<survey_id>
    

    你会得到这样的回应

    {
      "title": "My Survey",
      "custom_variables": {
        "name1": "label1",
        "name2": "label2"
        ...
    
      },
      ...
    }
    

    然后当你fetch survey responses,假设他们被填写,你会得到这样的回复:

    GET /v3/surveys/<survey_id>/responses/<response_id>
    {
      "id": "<response_id>",
      "response_status": "completed",
      "custom_variables": {
        "name1": "value1",
        "name2": "value2"
        ...
      },
      ...
    }
    

    关于Custom Values,这些是存储在通讯簿中联系人资源中的自定义数据,用于在电子邮件收集器(不是调查)上创建收件人。

    因此,当您在电子邮件收集器上create a new recipient 时,您可以设置custom_fields,它们存储在联系人和收件人中。当您获取该收件人时,它会如下所示:

    GET /v3/collectors/<collector_id>/recipients/<recipient_id>
    {
        "id": "<recipient_id>",
        "email": "<email>",
        "first_name": "<first_name>",
        "last_name": "<last_name>",
        "custom_fields": {
          "1": "field1",
          "2": "field2",
          "3": "field3",
          ...
        }
        ...
    }
    

    然后,当该特定收件人回答调查并且您获取响应时,您将在响应元数据中获得联系信息,例如:

    GET /v3/surveys/<survey_id>/responses/<response_id>
    {
      "id": "<response_id>",
      "response_status": "completed",
      "metadata": {
        "contact": {
            {
              "id": "<response_id>",
              "response_status": "completed",
              "metadata": {
                "contact": {
                    "first_name": {
                      "type": "string",
                      "value": "<first_name>"
                    },
                    "last_name": {
                      "type": "string",
                      "value": "<last_name>"
                    },
                    "name1": {
                      "type": "string",
                      "value": "value1"
                    },
                    "name2": {
                      "type": "string",
                      "value": "value2"
                    },
                    "name3": {
                      "type": "string",
                      "value": "value3"
                    }
                },
                ...
              },
              ...
            }
            ...
        },
        ...
      }
    }
    

    请注意,元数据在bulk responses endpoint 中只有名字、姓氏和电子邮件。这是当前批量响应的限制。

    希望这有助于澄清差异。

    【讨论】:

    • 感谢您提供的内容丰富的帖子。我知道这是两年前的事了,但我非常感谢——SurveyMonkey 清楚地写了他们的文档 :)
    【解决方案2】:

    当您使用以下网址时

    https://api.surveymonkey.net/v3/surveys/{SURVEY_ID}/responses/bulk,

    作为响应,您将获得自定义变量,

    {
      "per_page": 50,
      "total": 6,
      "data": [
        {
          "total_time": 108,
          "href":"https://api.surveymonkey.net/v3/surveys/119486428/responses/6287196301",
          "custom_variables": {
          "key1": "value1",
          "key2": "value2"
        },
    }    
    

    我正在使用网络收集器。并添加自定义变量作为 url 参数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多