Get statuscode from cURL

Discussion created by dambam on Aug 30, 2017
Latest reply on Feb 11, 2018 by databuzz



I recently started to using the new cURL functionality in FM16, and have successfully transfered JSON data to our bookkeeping system using their API. However, in certain scripts I send data to different URLs in the bookkeeping system, meaning that I need to send data multiple times in a single script. What I need is a way to see wether or not the data transmission has been successful, and exit the script if any data transfer fails. I guess the best way would be to do use HTTP status codes, and if it is not 2xx terminate the script. Is there a way to extract only the status code instead of the whole header dump, or does anyone have a formula which I could use to get it from the header dump?


Greatly appreciate all help I can get!