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!

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Is src property one of your inputs? What input type is it and how are you passing your data to it?
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    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!
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    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) 
  • Georges Duverger
    Georges Duverger Trusted Xano Expert
    Options
    FTR, I'm taking a look on the Draftbit side of things.
  • Georges Duverger
    Georges Duverger Trusted Xano Expert
    Options
      We've identified the issue to be a bug on the Draftbit side. We're addressing it now.
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     thanks for being proactive about this and figuring that out 🤝