Go REST
L

Post Create User Always response 422 Unprocessable Content

Luis Enrique over 2 years ago 3840 views 3 replies

I post this object {name:Luis, gender:male, email:holasdasd@gmail.com, status:active} and allways response [
{
field: email,
message: can't be blank
},
{
field: name,
message: can't be blank
},
{
field: gender,
message: can't be blank, can be male of female
},
{
field: status,
message: can't be blank
}
]

but i have send it,
please contact support go rest

3 replies
L
Luis Enrique over 2 years ago

cc: suport go rest

Z
zeevy over 2 years ago

Can you please share your code, may be content header application/json is not set or your are not posting json object

L
Luis Enrique over 2 years ago

This is my code obviusly replacing Bearer XXXXXXX to real token

const headers = {
'Accept':'application/json',
'Content-Type': 'aplication/json',
'Authorization': 'Bearer XXXXXXXXXXXXXXXXX'
}

export const postUsers = async (newUser: Usuario) => {
return await axios.post<any>( 'https://gorest.co.in/public/v2/users', newUser , {headers: headers});
}

Your reply

Markdown supported