Discussions
Invalid multipart request body and/or headers supplied.
hello, Im sending a post request to 'https://api.personio.de/v1/recruiting/applications/documents' and im encoding the file to base64 but i getting the title error.
thanks
Hi Santiago,
You need to send your request as a multipart/form-data
, and the file
param should be sent as a binary blob, not encoded as base64. You can check our documentation for an example in PHP, or else please refer to the documentation for the language/tool you're using to send your requests.
Please let us know if you're facing issues after this.
Cheers,
Nico
Hello Santiago,
Just following up to see if Nicolas's response above was able to solve your issue?
Thanks,
Amrit
Hi!
Im having the same problem, and converting the file to a binary one doesnt work.
Thanks,
AndrΓ©s
Hi Andres,
Could you provide more context about how you're sending your request? The issue might be related to the way this request is being built within your application code, and since this is specific to the language/framework you're using we might not be able to fully help troubleshooting it. If you believe this is not the case, I'd suggest to try replicating your request in a REST API client such as Postman (remember to send it as multipart/form-data
) to rule out any issues on the API itself. If this is successful, you can use this request a reference for implementing your code.
Cheers,
Nicolas
Hi!
I use this way to send the data. Because of privacy, the company Id and the authorization token i will omit it.
const form = new FormData();
form.append('file', req.body.file);
const options = {
method: 'POST',
headers: {
accept: 'application/json',
'X-Company-ID': '',
authorization: '',
'Content-Type': 'multipart/form-data',
},
body: form,
};
fetch('https://api.personio.de/v1/recruiting/applications/documents', options)
.then((response) => response.json())
.then((response) => console.log({ response }))
.catch((err) => console.error(err));
Hi Andres,
This is nodeJS on the server and not javascript in the browser right? Otherwise it won't work due to CORS errors.
A quick search suggests that you should remove the Content-Type
header from your request for it to be added automatically together with the boundary. The example is for the browser, but it's possibly the same case here.
Hope this helps.
Cheers,
Nicolas
Hello Andres,
Checking in again to see if Nicolas's response above helped solve your issue?
Thank you for using Personio APIs.
Amrit
Hello Andres,
Do let us know if Nicolas's response helped to resolved your issue. Please be aware that we will be autoclosing this thread in 24 hours if we do not receive a response.
Thank you for using Personio APIs.
Amrit
Hi Andres,
We will be closing this thread now. Please feel free to initiate a new thread, if you so desire.
Thank you for using Personio APIs.
Amrit
ο»Ώ