How to obtain both Header and Body from Insert from URL

I'm using Insert from URL to interact with an API. When I do this the body of the response returned is inserted into the field or variable. I also want to extract the header values as they contain information that we need.

I can get this information by specifying the "-I" header but that means making a second call. One call for the head, and a second call for the body.

Is it possible to extract both the headers and the body?

yup

add this curl option to your request:
--dump-header $responseHeaders

and the response headers should then be stored in that variable.

2 Likes

I really like using Proof+Geist script called HTTP ( {request} ) to handle just about any cURL call. You can find it here: GitHub - proofgeist/mfm-http: A single script that can handle all HTTP requests with Filemaker

4 Likes

Thanks @jwilling. I had thought that dump headers should do it but reading the posts at stack overflow I got the impression it was for dumping headers on the way out.

2 Likes