gpt4 book ai didi

Surveymonkey 以编程方式创建新调查?

转载 作者:行者123 更新时间:2023-12-02 01:37:50 25 4
gpt4 key购买 nike

如何使用 surveymonkey API 以编程方式创建新调查(带有新问题和选项)?

我能找到的唯一相关 API 方法是 create_flow,它适用于现有调查/模板。我不确定它是否允许修改调查以包含新问题

最佳答案

如前所述,在 API 的第 2 版中无法执行此操作。这现在可以在 API v3 中实现。

在此处查看文档:

https://developer.surveymonkey.com/api/v3/#surveys

例子:

创建一个新调查:

POST /surveys
{
"title": "Example Survey"
}

这将返回调查的 survey_id。用它来创建一个新页面:

POST /surveys/<survey_id>/pages
{
"title": "My First Page",
"description": "Page description",
"position": 1
}

这将返回页面的 page_id,用它来创建一个新问题:

POST /surveys/<survey_id>/pages/<page_id>/questions
{
"family": "single_choice",
"subtype": "vertical",
"answers": {
"choices": [
{
"text": "Apple",
"position": 1
},
{
"text": "Orange",
"position": 2
},
{
"text": "Banana",
"position": 3
}
]
},
"headings": [
{
"heading": "What is your favourite fruit?"
}
],
"position": 1
}

或者,如果您已经拥有要创建的整个调查,则可以通过使用整个有效负载对原始端点执行 POST 来一次性创建它:

POST /surveys
{
"title": "Example Survey",
"pages": [
{
"title": "My First Page",
"description": "Page description",
"position": 1,
"questions": [
{
"family": "single_choice",
"subtype": "vertical",
"answers": {
"choices": [
{
"text": "Apple",
"position": 1
},
{
"text": "Orange",
"position": 2
},
{
"text": "Banana",
"position": 3
}
]
},
"headings": [
{
"heading": "What is your favourite fruit?"
}
],
"position": 1
}
]
}
]
}

关于Surveymonkey 以编程方式创建新调查?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30064623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com