[Solved] Sending Boolean = True, getting "invalid" wont accept "1"
Options
Sam Bevis
Member ✭
Hi guys,
I am sending an API request Parameter as follows:
isGlobal:
true,
isRollupReportingLocation:
false,
And Im getting the following returned:
400 Error
location.IsGlobal: [The value '1' is not valid for IsGlobal.],
location.IsRollupReportingLocation: [The value '0' is not valid for IsRollupReportingLocation.]
Anyone had this issue before? I can't see where this is sending as a "1" rather than "true". Is there a way to see the raw data to see if Xano is converting my "true" to "1"?
I am sending an API request Parameter as follows:
isGlobal:
true,
isRollupReportingLocation:
false,
And Im getting the following returned:
400 Error
location.IsGlobal: [The value '1' is not valid for IsGlobal.],
location.IsRollupReportingLocation: [The value '0' is not valid for IsRollupReportingLocation.]
Anyone had this issue before? I can't see where this is sending as a "1" rather than "true". Is there a way to see the raw data to see if Xano is converting my "true" to "1"?
Comments
-
[image.png]Fixed it by forcing a string... however for debugging purposes it would be great to understand how I could see the RAW data being sent (showing the boolean being sent as a "1" rather than "true"
-
is for an API request you are sending out? If so, sending your request to something like https://webhook.site instead of the external service URL would let you see the exact payload you are transmitting.
-
yes it was for posting a new entry via an API - but I was getting an error with the boolean.
Thanks for another debugging option - it's a shame you cant view the raw request within Xano itself (unless its hidden somewhere?).
When I get into the nitty of my next build Ill sign up to your statechange membership so I can hassle you over there 😃 -
You can use your API Request History to view the payload that is being sent - open a request and expand the input... You can even copy the input with the click of a button and paste it in your debugger to run with the exact payload that was sent. Regarding booleans, Xano stores and sends out booleans as true/false - it wouldn't transform these values when being sent or outputted. But Xano ACCEPTS boolean values of true/false, yes/no, and 1/0
-
I was developing in the Library>Functions area - so I didnt have access to the API>Request history. As a workaround Im guessing I could set it to a task, then view the task history?
If Xano doesnt convert a "true" to "1" I wonder why I was getting that error response? I was definatley sending a "boolean true" with my request in the function stack, and then getting the error as a response. It was only when I forced the "text" into the request when it started to work... anyway its all working nowCheers mate.
-
- it would also be super handy if we could post "code snippets" in this community help area, to make it easier to read 🙂
-
How did you solve it, Your image not visible!
-
how did you fix it i have the same issue while creating a csv i don't get true just 1 and empty if false
-
Hi @bok @Jacksonm93 - as per my first reply in this post, I had to force a "String" stating the words "true" and it worked. When it was set to boolean it was sending a "1" instead of the words "true".
-
how did you force a string? replace is not working for me
-
-
@bok - did that fix it for you?
-
This bug is still happening to me as of Sept 21, 2023.
When saving a boolean into a json object in Xano's database you must convert the boolean it into a text value, otherwise, when retrieving it from the database, you will get a number instead of the boolean. -
Might be worth looking into it @Michael Udinski
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