API error on POST
Options
Hi all!
I have a POST endpoint setup that post some input fields to a database, and encrypts them as it does so. It works when I test it in Xano, however when I add the endpoint in my Draftbit front-end it gives the error:
"ERROR":{
"message":
"src property must be a valid json object"Can anyone point me in the direction I should be looking? Googling the error hasn't returned anything I can make sense of!
I have a POST endpoint setup that post some input fields to a database, and encrypts them as it does so. It works when I test it in Xano, however when I add the endpoint in my Draftbit front-end it gives the error:
"ERROR":{
"message":
"src property must be a valid json object"Can anyone point me in the direction I should be looking? Googling the error hasn't returned anything I can make sense of!
Comments
-
Is src property one of your inputs? What input type is it and how are you passing your data to it?
-
Any screenshots would be helpful
-
Thanks Michael,
Here's some screen shots from the XANO API page:
[Screenshot 2021-11-02 at 00.15.00.png][Screenshot 2021-11-02 at 00.15.26.png][Screenshot 2021-11-02 at 00.15.33.png]
And here's the endpoint in Draftbit:
[Screenshot 2021-11-02 at 00.15.58.png]
And the error:
[Screenshot 2021-11-02 at 00.16.05.png]
Thanks! -
Admittedly I am not a Draftbit expert yet - so correct me if I'm wrong with the below but a couple things stick out to me - I'd think your input values would still need to be wrapped in "" to pass valid json... such as:
{
"Input": "{{Input}}",
"Input_2": "{{Input_2}}"
}
Also I noticed that your keys above are different then the JSON body input names... Input_1 vs input1
[CleanShot 2021-11-01 at 17.27.00.png] -
I think it should work without the "" wraps around the inputs. (At least it is working in other endpoints I have set up with the same syntax, and changing it doesn't fix the error.)
Here's a working endpoint (that does the same thing, but without the encryption)
[Screenshot 2021-11-02 at 00.38.43.png]
And here's the one that isn't working with the encryption (I made a few edits from before)
[Screenshot 2021-11-02 at 00.40.20.png]
The keys are autogenerated by Draftbit, though good spot on it not writing the '_'. -
Sorry mate, missed this comment before. I don't think it is one of the inputs - I'm pretty confused as to what it's referring to.
-
(cross-posted this to the Draftbit community as I think the issue may be on that side)
-
FTR, I'm taking a look on the Draftbit side of things.
-
We've identified the issue to be a bug on the Draftbit side. We're addressing it now.
-
thanks for being proactive about this and figuring that 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