Tech Tip: Handling HTTP Request error #17
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: September 13, 2021
When working with third-party APIs and using HTTP Request to send API calls, occasionally an error may occur that states “Unimplemented control instruction”. This may be due to the third-party API not handling the request correctly and not responding within a certain window. To avoid this, try calling the HTTP Request command without the keep-alive (*) parameter. If it happens often, catch the error (#17) and simply re-issue the same request. Below is an example:
$http_status:=HTTP Request(HTTP POST method;$url;$body;$response;$headerNames;$headerValues) If (Error=17) $http_status:=HTTP Request(HTTP POST method;$url;$body;$response;$headerNames;$headerValues) End if |
Note that using the Error variable means that you are using ON ERROR CALL to catch the error.