Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > REST API Connections > RestConnection class > RestConnection Methods

requestWithAuth

Scroll Prev Next More

 

This function adds authentication data to the request and executes it.

Syntax

 

requestWithAuth(request)

 

Arguments

request

HttpRequest object

Return value

 

If the operation was successful it returns the body of the server's response.

If unsuccessful it returns false.

Examples

 

Use lastError() function to get the error details. If the server returns an error, lastError() returns the whole server response, header and the body.

 

dynamic rconn = null, request = null, response = null;
request = new HttpRequest( "https://api.service.com/resource" );
rconn = CommonFunctions.getRESTConn();
response = rconn.requestWithAuth(request);