You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to do proper error handling in REST WebServices?

edited Nov 13, 2023 2:46PM in Sales 2 comments

Summary:

I want to do proper error handling with REST WebServices and looking at the documentation I found that:

def conn = adf.webServices.GetTicketForAccount

try{

// Provide Account Id for which user wants to retrieve trouble ticket

def tickets = conn.GET("6637911")


println("Headers:"+conn.responseHTTPHeaders)

println("Status:"+conn.statusCode)

println("Output:"+tickets)

}catch(Exception e){

println("Headers:"+conn.responseHTTPHeaders)

println("Status:"+conn.statusCode)

println("Error:"+e)

}

But that when I call for example a POST Service Request with a wrong value it returns to me Bad Request 404 and it enters the catch exception but the variables are all null/empty.

responseHTTPHeaders is null

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!