How would you make this post request considering that the documentation is showing you this
POST /cf HTTP/1.1
Host: apis.woptima.com
Content-Type: application/json
{
"name": "franco",
"surname": "Baldi",
"gender": "M",
"day": 22,
"month": 12,
"year": 1980,
"city": "Roma",
"province": "RM"
}
I tried my way and dind't work out, I get validationError 422
fetch("https://cors-anywhere.herokuapp.com/https://apis.woptima.com/cf", {
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
method: POST,
// I also tried with the body object, didn't work
name: "franco",
surname: "Baldi",
gender: "M",
day: 22,
month: 12,
year: 1980,
city: "Roma",
province: "RM",
})
.then(function (response) {
return response.json()
})
.then(function (data) {
console.log(data)
})
}
If you can help me I will appreciate