Discussions

Ask a Question
Back to All

Document Upload MediaType Not Supported Error

On POST Request to Document Upload for Application, I keep getting MediaType not supported error, even though base64 Data String and other parameters match the request.

I'm sending the request via PHP and function body looks like this that handles the request:

$body = $req->get_body();
$headers = $req->get_headers();
$token = $headers['authorization'][0];

$url = 'https://api.personio.de/v1/recruiting/applications/documents';

$response = wp_remote_post( $url, array(
'method' => 'POST',
'headers' => array(
"Accept: application/json",
"Content-Type: multipart/form-data",
'X-Company-ID: XXXXXX',
'Authorization' => "Bearer $token",
),
'name' => 'file',
'filename' => 'test file name',
'contents' => $body

$body is the argument I give with base64 string for the document via Front-End.