EDIT: Apperently the mistake (in my third example) was the '?' in http://example.herokuapp.com/api/v1/tickets? After I removed it, it works :)
I am trying to make a post request with axios and when I do it in postman it all works fine, but when I do it in my code, I always get a 500 or 400 back.
In postman my (data is sample data here) my url:
http://example.herokuapp.com/api/v1/tickets?
in my body inside postman:
pin: 123ABC,
ride_id: 24,
token: XXAAXXAAXX
so then in my code I tried everything.
first try:
return axios.post("http://example.herokuapp.com/api/v1/tickets?pin="123ABC"&ride_id=24&token=XXAAXXAAXX")
Here I get Error: Request failed with status code 400
2nd try:
return axios.post("http://example.herokuapp.com/api/v1/tickets?", {
params: {
pin: "123ABC",
ride_id: 24,
token: "XXAAXXAAXX"
}
third try:
return axios.post("http://example.herokuapp.com/api/v1/tickets?", {
pin: "123ABC",
ride_id: 24,
token: "XXAAXXAAXX"
})
Any help would be so much appreciated!!!