Skip to main content
Best answer

How do I inject input field values into the request body of an API call, for a custom app action?

  • May 3, 2026
  • 1 reply
  • 3 views

Forum|alt.badge.img+1

I’m configuring my API request with code rather than form. The from and to fields are expecting the date strings:

“2026-03-01”, “2026-03-31”

I tried this:

const options = {
  url: 'https://fakeurl.com/search',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json'
  },
  params: {

  },
  body: {
      data: {
        advanced_search: {
          per_page: 100,
          query: {
            $all: [
              {
                $all: [
                    {
                        $condition: {
                            attr: "CreatedAt",
                            ope: "range",
                            from: `"${bundle.inputData.start_date}"`,
                            to: `"${bundle.inputData.end_date}"`
                        }
                    }
                ]
              }
          }
        }
      }
  }
}

But the request fails. If I replace the $condition object with this:

                        $condition: {
                            attr: "CreatedAt",
                            ope: "range",
                            from: ”2026-03-01”,
                            to: "2026-03-31"
                        }

The request succeeds. When I’m using the input variables, they are entered as 2026-03-01 and 2026-03-31 respectively. They are string fields. So I must be accessing the input variables incorrectly. How do I fix this?

Note, I’m having trouble seeing what the resulting request body is. Adding z.console.log('Request body:', JSON.stringify(options.body, null, 2)); didn’t seem to result in any logs when I tested this action.

Best answer by BobbyA

This worked:
 

$condition: {
                            attr: "CreatedAt",
                            ope: "range",
                            from: bundle.inputData.start_date,
                            to: bundle.inputData.end_date
                        }


I think, because the input fields are marked as Strings, the quotations are automatically added around the values entered into those fields
 

 

1 reply

Forum|alt.badge.img+1
  • Author
  • Beginner
  • Answer
  • May 3, 2026

This worked:
 

$condition: {
                            attr: "CreatedAt",
                            ope: "range",
                            from: bundle.inputData.start_date,
                            to: bundle.inputData.end_date
                        }


I think, because the input fields are marked as Strings, the quotations are automatically added around the values entered into those fields