I'm trying to submit an application to Greenhouse with the following way:
$url = "https://api.greenhouse.io/v1/boards/{MY_BOARD_TOKEN}/jobs/{MY_JOB_ID}";
$args = [
'headers' => [
'Content-Type' => 'multipart/form-data',
'Authorization' => 'Basic ' . base64_encode('{MY_API_TOKEN}'),
'Cache-Control' => 'no-cache',
],
'body' => $form,
];
$response = wp_remote_post($url, $args);
But I'm getting the following error:
{"status":400,"error":"Failed to save person"}
My $form looks like this:
[
'first_name' => 'John',
'last_name' => 'Doe',
'email' => 'john@doe.com',
]
I'm sure the credentials are OK.
Thanks in advance,
Status code: 400 Bad Request
The 400 (Bad Request) status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). Link
Means that need to double check you request to API.
I suggest to test it in some other tool and copy&paste request after that.
You could use Restlet Client - REST API Testing for checking.