External API Request with raw/binary body
Hi again,
I am trying to send data to the algolia API. see
The API expects the data to be in the body, with —data-binary/raw.
How can I send the data like that? It is not working with the params option from the external api request function.
I also tried the “import from curl” method but same result, the API is not happy with the data format I am sending.
test data:
Error message: “lexical error: invalid string in json text. Around 'name=Betty'”
Best Answer
-
Okay I solved it myself: You need to add a Content-Type header to change the way the data is sent. (Maybe you could add this info to the docs somewhere? @Michael Udinski
Answers
-
Hey @Stefan Pointecker the Content-type header typically depends on the API service, sometimes it's required, sometimes not, and it's not always application/json depending on the API call. I can see from the API docs you posted, they discuss the required format near the top: https://www.algolia.com/doc/rest-api/search/#format
-
Yes I know Michael, I meant that maybe its good to see in the xano api what's the default xano way of sending the data. to be honest, it was the first time I had to change the header (in the api request function) and it took me some time to figure it out.
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