Brian Dunning's FileMaker Custom Functions

httpResponseCode ( responseHeaders )

Retrieves the last HTTP Response Code from the Response Headers

  Average rating: 3.5 (2 votes) Log in to vote

Andrew Duncan   Andrew Duncan
Databuzz
https://www.databuzz.com.au

Share on Facebook Share on Twitter

  Sample input:
httpResponseCode ( "HTTP/1.1 200 OK
Date: Wed, 13 Jun 2018 04:45:17 GMT
Server: Apache/2.4.26 (Red Hat)
X-Powered-By: PHP/5.6.35
Transfer-Encoding: chunked
Content-Type: application/json; charset=UTF-8" )
  Sample output:
200

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

When working with APIs you often need to check the HTTP Response Code to confirm the request was successful. By passing in the Response Headers from your HTTP request this function will return the last response code found in the Response Headers. For example when using the native cURL options in FileMaker Pro v16 and later:

" --dump-header $responseHeaders"

If more than one response code is returned it will return the last response code from the Response Headers.

N.B. this function requires the Trim4 custom function

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.