During a develpment of an App using Make SDK (integromat.com) I was getting the error:
DataError
Invalid module output. Expected Object, but found Array.
The module tries to use the feature of Multiple Requests to get all the information about a document in this specific API from two endpoints.
api.imljson
[
{
"url": "/v1/documents/{{parameters.uuid_doc}}/webhooks",
"method": "GET",
"response": {
"temp": "{{ first(body) }}"
}
/**
Response Example:
[
{
"uuid": "d0b0b0b0-0b0b-0b0b-0b0b-0b0b0b0b0b0b",
"webhook_url": "https://hook.us1.make.com/..."
}
]
*/
},
{
"url": "/v1/documents/{{parameters.uuid_doc}}",
"method": "GET",
"response": {
"output": "{{ merge( first(body), temp) }}"
}
/**
Response Example:
[
{
"uuidDoc": "d0b0b0b0-0b0b-0b0b-0b0b-0b0b0b0b0b0b",
"nameDoc": "DOC",
"type": "application/msword",
"size": "29184",
"pages": "2",
"uuidSafe": "d0b0b0b0-0b0b-0b0b-0b0b-0b0b0b0b0b0b",
"safeName": "Vault",
"statusId": "2",
"statusName": "Waiting",
"statusComment": null,
"whoCanceled": null
}
]
*/
}
]
expect.imljson
[
{
"name": "uuid_doc",
"type": "uuid",
"label": "Document ID",
"required": true
}
]
I tried to change the module type to Action and Action Type to Multipurpose and didn’t worked.
The solution after all was defining output
for the first request:
api.imljson
[
{
"url": "/v1/documents/{{parameters.uuid_doc}}/webhooks",
"method": "GET",
"response": {
"temp": "{{ first(body) }}"
,"output": "{{ first(body) }}"
}
/**
Response Example:
[
{
"uuid": "d0b0b0b0-0b0b-0b0b-0b0b-0b0b0b0b0b0b",
"webhook_url": "https://hook.us1.make.com/..."
}
]
*/
},
{
"url": "/v1/documents/{{parameters.uuid_doc}}",
"method": "GET",
"response": {
"output": "{{ merge( first(body), removeKeys(temp, ['uuid']) ) }}"
}
/**
Response Example:
[
{
"uuidDoc": "d0b0b0b0-0b0b-0b0b-0b0b-0b0b0b0b0b0b",
"nameDoc": "DOC",
"type": "application/msword",
"size": "29184",
"pages": "2",
"uuidSafe": "d0b0b0b0-0b0b-0b0b-0b0b-0b0b0b0b0b0b",
"safeName": "Vault",
"statusId": "2",
"statusName": "Waiting",
"statusComment": null,
"whoCanceled": null
}
]
*/
}
]