User bio
404 bio not found
Rome, Italy
Member since Jul 24
Pinned posts:
Replies:

Hi, you can try something like this: 

Set sc = $$$OK
// Send a GET request
Set messageStatus = httpRequest.Get()

// Analyze response code
If '($$$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 status
        Set 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 sc

You can manage any status code in the way you prefer (not just code 200 or 404) 

Certifications & Credly badges:
Pietro has no Certifications & Credly badges yet.
Global Masters badges:
Followers:
Following: