Upload file using HTTP Request working with an API

Describe the issue/error/question

I tried to recreate this fetch,

const form = new FormData();
form.append('nature', 'attachment');
form.append('file', 'data:application/pdf;name=pdf24_converted.pdf;base64,JVBERi0xLjQKMSAwIG9iago8PAovVGl0bGUgKP7/AEUAeABhAG0........');
const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    authorization: '**********************************************'
  }
};

options.body = form;

fetch('https://api-sandbox.yousign.app/v3/documents', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

So that what i used inside my configuration

But the response is
image

As you can see it tells me that the “file” input inside form data has no content
but It has a pdf that is encode in base64

Information on your n8n setup

Running n8n via [Docker]

Finally SUCCEDED !!!

Okay to help other, i tried on postman, and there was a problem with the api.
it doesn’t like base64.
So i used n8n binary data in upload file,
I had to change the fileName of the binary data because it was in the wrong format !

2 Likes

Sweet, glad to hear you figured. Thanks so much for sharing and welcome to the community!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.