How to access/reference JSON payload accepted at endpoint later in the function stack?

Options

Hello, I've created an endpoint to accept a POST from TypeForm, which has a JSON payload.

How do I reference the payload received in the request to the endpoint?

I can see the payload when I click "Request History" in the menu for the endpoint, and can traverse the JSON there. But, when I try to reference it in the function stack, I can't figure that out.

I would expect that the JSON object received would be able to be referenced using some type of dot notation.

For example, given the request below (screenshot), if I want to get the "invite" value, I would expect something like:

requestbody.form_response.hidden.invite

However, there doesn't seem to be an object called "requestbody" or anything like that.

Is there a way to "pre-define" the structure of the JSON that I am expecting at this endpoint such that I can reference it in the function stack?

I tried to make the endpoint's input type "JSON" but then somehow what's received isn't correlated with the actual payload.

Thanks in advance for pointing me in the right direction here.

Tagged:

Answers

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    there is a utility function called get all input that is on point for your need here. It will collect all the data in that body into a single json variable you can use in your function stack.

  • xanosun
    xanosun Member
    edited September 2023
    Options

    Ray, thanks! Got it to work.

    At first, it wasn't working and I was getting a 500 error. But, that was because I hadn't re-created the variable to select the sub-path. Rebuilding it with dot notation worked.

    Thank you—that "Get All Input" helper is a critical helper function.