const response = await fetch('https://ushahididocs.api.ushahidi.io/api/v5/surveys/2', {
method: 'PUT',
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": "test2",
"description": "<p>test desc 2</p>",
"base_language": "en-US",
"require_approval": true,
"everyone_can_create": true,
"translations": {},
"tasks": [
{
"priority": 0,
"required": false,
"type": "post",
"label": "Post",
"show_when_published": true,
"task_is_internal_only": false,
"translations": {},
"fields": [
{
"cardinality": 0,
"input": "text",
"priority": 1,
"required": true,
"label": "Title",
"type": "title",
"config": {},
"form_stage_id": "interim_id_0",
"translations": {},
"$$hashKey": "object:830"
},
{
"cardinality": 0,
"input": "text",
"priority": 2,
"required": true,
"label": "Description",
"type": "description",
"options": [],
"config": {},
"form_stage_id": "interim_id_1",
"translations": {},
"$$hashKey": "object:831"
}
],
"is_public": true
},
{
"required": false,
"fields": [
{
"required": false,
"options": [],
"config": {},
"priority": 0,
"translations": {},
"label": "field 2",
"type": "varchar",
"input": "text",
"description": "<p>A sentence or less</p>",
"$$hashKey": "object:893",
"instructions": "",
"form_stage_id": "interim_id_3",
"__$markdownParsed": true
}
],
"type": "task",
"show_when_published": false,
"task_is_internal_only": true,
"label": "task 2",
"priority": 1,
"$$hashKey": "object:867"
}
],
"enabled_languages": {
"default": "en-US",
"available": []
},
"__$markdownParsed": true
}),
});
const data = await response.json();