I have to make a POST request, to an API that was given to me.
I am supposed to send some data to it and get back an JWT
token.
The data i have to send is an object called data
like this:
{
"firstName": "Jane",
"address": "Lohmühlenstraße 65",
"numberOfChildren": 2,
"occupation": "EMPLOYED",
"email": "jane.doe@getpopsure.com"
}
And the API docu looks like this:
curl https://challenge-dot-popsure-204813.appspot.com/user \
-H 'Content-Type: application/json' \
-d '{"firstName":"Jane","address":"Lohmühlenstraße 65","numberOfChildren":2,"occupation":"EMPLOYED","email":"jane.doe@getpopsure.com"}' \
-X POST
I am sending with axios a POST
request, with an object, but i get an 422
Error:
Failed to load resource: the server responded with a status of 422 ()
This is my POST request, where data
is the object above:
axios.post('https://challenge-dot-popsure-204813.appspot.com/user', data)
.then(function (response) {
debugger
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Any ideas what can be the issue?