How can i retrieve value from HTTP response?

Hi, Make Experts,

I need help. After successful HTTP request. I get a return header as below. I wish to extract the “location” value which is “value”: “https://api.tinify.com/output/y863vpjw8eesd”. How can i do that? Appreciate your help.

    "headers": [
        {
            "name": "date",
            "value": "Wed, 08 May 2024 06:34:04 GMT"
        },
        {
            "name": "location",
            "value": "https://api.tinify.com/output/y863vpjw8eesd"
        }
    ],

Welcome to the Make community!

You can use the built-in functions map and first

e.g.:

{{ first(map(6.headers; "value"; "name"; "location")) }}

For more information, see “Mapping with arrays” below.

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

Articles & Videos

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

1 Like

Hi, Sam,

I have header as below, but the MAP function doesnt retrieve the URL correctly. what is going wrong?

“headers”: [
{
“name”: “location”,
“value”: “https://api.tinify.com/output/y863vpjw8ee
},
]

image

Remove the double quotes.

Those only work if you copy the full code from my previous post, including the {{ }}

Not only that, I’m pretty sure value and name has to be lower case.

And you also forgot the first function.

Why not try copying my previous post and pasting it into your field?

If you want to manually type it in,

first(map({{6.headers}};value;name; location))

3 Likes

Great, it works now. Thank you very much :grinning:

2 Likes

No problem, glad I could help!

1. If you have a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

  • others can save time when catching up with the latest activity here, and
  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

1 Like