Getting a 422 error while making a post request

const res = await fetch( "https://gorest.co.in/public/v2/posts", { headers: { "Authorization": Bearer ${API_TOKEN}, 'Accept': 'application/json', "Content-Type": 'application/json' } }

Respose data says "user" must exist. It worked 2-3 times before

The user I'd used in the body should exists.

If the user is modified or added by someone else then you can't add posts to that user.

Please create or modify any user and use that user Id in payload

fetch('https://gorest.co.in/public/v2/users', { method: 'POST', body: JSON.stringify[{ name: "Roman", email: "[email protected]", gender: "man", status: "active" }], headers: { Authorization: "Bearer e142ed77beaafae6c253c95ebed2b3770a455e8fe2577e12956f1a227b7656e9,", "Content-Type": "application/json" } })

fetch('https://gorest.co.in/public/v2/users', { method: 'POST', body: JSON.stringify[{ name: "Roman", email: "[email protected]", gender: "man", status: "active" }], headers: { Authorization: "Bearer e142ed77beaafae6c253c95ebed2b3770a455e8fe2577e12956f1a227b7656e9,", "Content-Type": "application/json" } })


Little markdown supported