0

I trying to get the response from the HTTP Widget but he wont return.

i am currently using a free API to test and the API return is:

{"slip": { "id": 163, "advice": "Big things have small beginnings."}}

What i tried:

{{widgets.req.response.parsed.slip.advice}} {{widgets.req.parsed.slip.advice}} {{widgets.req.body.slip.advice}} {{widgets.req.slip.advice}}

but without sucess, the request returns 200 and i can see the json body using: {{widgets.MY_WIDGET_NAME.body}}

i am currently using the send message to get the response

any ideas?

my flow: FLOW whats the correct variable way to get the values

1 Answers1

1

From what you provided, the correct reference should be {{widgets.MY_WIDGET_NAME.slip.advice}} for the value "Big things have small beginnings."

This is explained further in the docs for Returning JSON

If your request returns an object in valid JSON, you will be able to access it via widgets.MY_WIDGET_NAME.parsed.

For example, if your URL returns {"message": "Hi", "person": {"name": "Bob", "age": 40}}, you can reference that in subsequent widgets as:

widgets.MY_WIDGET_NAME.parsed.message

widgets.MY_WIDGET_NAME.parsed.person.name

widgets.MY_WIDGET_NAME.parsed.person.age
jassent
  • 529
  • 3
  • 10
  • Already used but without success. – Felipe Cruz Jun 12 '23 at 15:41
  • i added the flow print to post – Felipe Cruz Jun 12 '23 at 15:48
  • Are you certain of the JSON being returned from the Req widget? Did you set the content type to application-json of your api that is returning the data? You should be able to use the Flow inspector to view the actual data being returned by the API. This should give you the correct path to use and confirm if the data is in the correct format from the API. – jassent Jun 13 '23 at 11:33
  • If i change the request response to Json the request method change to POST but the API is GET – Felipe Cruz Jun 13 '23 at 19:01