As the title says, I am trying to update an existing form through the API and I am getting the following error
{"code":"VALIDATION_ERROR","description":"The payload is invalid.","details":[{"code":"WRONG_TYPE","description":"should be object","in":"body"}]}
Here is an example of the post data I use to create the form
data = [
'title' => 'title',
'type' => 'form',
'fields' => [
[
'properties' => [
'description' => 'brief',
],
'ref' => 'campaign',
'title' => 'campaign',
'type' => 'statement'
],
[
'properties' => [
'description' => 'details',
],
'ref' => 'event',
'title' => 'event,
'type' => 'statement'
]
],
'workspace' => [
'href' => 'https://api.typeform.com/workspaces/{href}
]
];
And this is the data I use to update it
data = [
'title' => 'title',
'type' => 'form',
'fields' => [
[
'properties' => [
'description' => 'brief',
],
'ref' => 'campaign',
'title' => 'campaign',
'type' => 'statement'
],
[
'properties' => [
'description' => 'new field',
],
'ref' => 'newfield',
'title' => 'new field',
'type' => 'statement'
],
[
'properties' => [
'description' => 'details',
],
'ref' => 'event',
'title' => 'event,
'type' => 'statement'
]
],
'workspace' => [
'href' => 'https://api.typeform.com/workspaces/{href}
]
];
As a side note, something I discovered is that if I add the new field below the last one, it works, is there any way I can sort the fields so I have the newly added fields where I need them?
Thanks in advance!