Hi, I’m creating a custom app, but I have a problem during a creation of a module.
I need to insert in the API body a document that I need to send. Before this module I inserted the module HTTP Get File that response with a buffer, I need to insert this buffer inside the body but, I don’t know how to do.
Someone can help me? I tried to copy some solution but no one works.
Thanks in advance
samliew
February 19, 2024, 12:44am
2
Welcome to the Make community!
Some screenshots would help. You can also show us your blueprint.
1 Like
Hi Samliew,
this is the JSON of the action that I created
{
// Request to API endpoint with parameter "id" defined in Mappable parameters.
"url": "/folders/{{ parameters.folder_id }}/documents/{{ parameters.document_id }}/file", // Relative to base URL
"method": "POST",
"headers": {
"bodyType": "multipart_form_data"
},
"qs": {},
"body": {
"formDataFields": [
{
"key": "file",
"data": "{{ parameters.data }}",
"fileName": "{{ parameters.filename }}",
"fieldType": "file"
}
]
},
// Response handling
"response": {
"output": "{{undefined}}" // Returns no output bundle as no API output is expected.
}
}
The reference of the API call is this
curl --location --request POST
'https://demo.validsign.com/be/folders/1234/documents/1234/file' \
--header 'content-type: multipart/form-data' \
--form 'file=@"/C:/MyFile.pdf"'
The path of the file will be replaced with the buffer of the function Get File
Thank you in advance
blueprint.json (34.2 KB)
samliew
February 19, 2024, 7:47am
4
This doesn’t look right.
Try
"Content-Type": "multipart/form-data"
Don’t work.
This is the input of my custom app
[
{
"folder_id": 10855,
"array_file": [
{
"data": "IMTBuffer(53270, binary, 6638df3f2c7855ae5cb6176d0798ecad1d92e068): 255044462d312e340a25d3ebe9e10a312030206f626a0a3c3c2f5469746c65202847697448756220436f70696c6f7420666f7220427573696e657373202d20496e7465726e616c205465726d7320616e6420436f6e646974696f6e73290a2f50726f6475",
"filename": "file.pdf"
}
],
"document_id": 9339
}
]
This is the input of the HTTP request that do the same work.
[
{
"ca": null,
"qs": [],
"url": "https://demo.validsign.com/be/folders/10811/documents/9302/file",
"gzip": true,
"method": "post",
"headers": [
{
"name": "Authorization",
"value": "Bearer {key_value}"
}
],
"timeout": null,
"useMtls": false,
"authPass": null,
"authUser": null,
"bodyType": "multipart_form_data",
"serializeUrl": false,
"shareCookies": false,
"parseResponse": true,
"followRedirect": true,
"formDataFields": [
{
"key": "file",
"data": "IMTBuffer(284573, binary, 1960f0f8913447bbda1ba6ba31aaf5c8fdae2f29): 255044462d312e370a25e2e3cfd30a382030206f626a0a3c3c202f54797065202f50616765202f506172656e74203120302052202f4c6173744d6f6469666965642028443a32303234303231363137303932332b30302730302729202f5265736f757263",
"fileName": "Verbale_Consegna_Materiali_Fabiana_Gatto.pdf",
"fieldType": "file"
}
],
"useQuerystring": false,
"followAllRedirects": false,
"rejectUnauthorized": true
}
]
_Kris
February 20, 2024, 12:56am
6
Try adding a “download file” module. That’s helped me before.
samliew
February 20, 2024, 1:41am
7
You can’t really do that in a custom app, or am I missing something?
1 Like
Yes, there is a “Get File” before the api call