Programmatically set API Request params from input
Hi, I'm new to Xano and trying to build a function that takes a params object as an input and maps it to the params of an API Request.
My input is as follows: "Type: object"; "Structure: single"
I tested the input using an object such as:
{ "page":1, "pageSize":1 }
I then add the params variable to the API Request in the params field. This doesn't seem to work: in the debugger, I see "params: [0]". I thought this would work since the API Request function's params argument is an object by default. Any help?
Best Answer
-
Changing the input to
JSON
will allow you to pass in an object with no defined schema as the input.Here is an example:
Let me know if this works for what you are trying to do. 😃
Answers
-
Hi @paolo.utile ! 👋
Welcome to the Xano Community! 🎉
You are seeing an empty array as the response because the schema was not defined in your input object. You should see the desired result once you define the schema in your object.
1.2.
3.
Let me know if this helps or if you have any additional questions! 😊
-
Hi @Liz Anaya , unfortunately that does not answer my question. My idea is to have an input object with no preset structure and pass it on to an API Request as a params object: this way, the function can be used by other functions with their own params object structure. This way, I have a reusable function for making generic API Requests to an API. I understand if this is not possible.
-
That did it! Thanks @Liz Anaya !
-
Yay! 🎉 Happy to help!
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