JSON error, but it works internally.
"I built an API that consumes the following JSON:
{
"endereco_cliente_id": 21,
"ofertas_quantidade": [
{
"oferta_id": 1,
"quantidade": 1
},
{
"oferta_id": 5,
"quantidade": 1
}
]
}
However, when I use it in Swagger, it returns a different result compared to Xano, and Postman is other result. With the same payload and everything identical, it throws an error. Have any of you encountered this issue? Please note that one of the input items is an object.
Answers
-
Hey @myrko! 👋
Can you provide us with more information about the error you are seeing and what the endpoint is doing?
Just a guess, but I'm wondering if you are getting the error because the "method" you are using is GET, and your endpoint is performing a different operation.
API Endpoint verbs
API Endpoints have a "method" or HTTP Verb associated them and the most common are POST, GET, PUT, PATCH, and DELETE. These verbs correspond to the CRUD (Create, Read, Update, Delete) operations, respectively. When you create an API endpoint, you must first define what type of verb it is.
-
I suspect the problem here is you mean a POST request. GET requests can't consume JSON directly because search strings (The part after the question mark in a URL) are form-encoded. I bet you mean to put it in the "body" of the request, and that implies a POST. Changing the type of the request likely clears it up!
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback