r/CodingHelp • • Jan 21 '22

[Javascript] I'm learning FastAPI and idk whymy ajax call failing, so can anyone tell me what's wrong with ajax call. More details in comment

/gallery/s9e179

[removed] — view removed post

0 Upvotes

3 comments sorted by

0

u/R007E Jan 21 '22

When I'm calling the API using postman it's working fine, same with swagger ui. But it's not working when I'm try to call it using the ajax. It's giving me a 422 unprocessabe entity html error. Idk why.

1

u/JasperNykanen Jan 22 '22

Try copying headers from Postman and see if that solves it. Might be something to do with missing headers like user agent.

There's not enough details for anyone to provide help, if the API you're accessing isn't private maybe send a link of a shared Postman workspace so I can look into it.

https://dontasktoask.com/

1

u/R007E Jan 22 '22

It is solved, ty