Hi, you can try something like this:
Set sc = $$$OK// Send a GET requestSet messageStatus = httpRequest.Get()
// Analyze response codeIf '($$$ISERR(messageStatus)) {
If httpRequest.HttpResponse.StatusCode = 200 {
// If a positive response was received // ...// ...
} ElseIf httpRequest.HttpResponse.StatusCode = 404 {
// Manage an HTTP status error// ...// ...// If you want a custom error statusSet ErrorText = "This is a string that contains your custom error text"Set sc = $$$ERROR(ErrorCode, ErrorText)
} Else {
// You can manage other HTTP codes here
}
} Else {
If '($ISOBJECT(httpRequest.HttpResponse.StatusCode)){
// Manage an error raised if the endpoint couldn't be reached or if you didn't get a response in time// ...// ...Set ErrorText = "This is a string that contains your custom error text"Set sc = $$$ERROR(ErrorCode, ErrorText)
}
}
Return scYou can manage any status code in the way you prefer (not just code 200 or 404)
- Log in to post comments
.png)
.png)