May 16, 2024 17:44 Parameters Supported Clients Sample Parameters Supported Clients Sample Parameters Supported Clients Sample Parameters Supported Clients Sample Parameters Supported Clients Sample Returns Supported Clients Sample Parameters Supported Clients SampleSupported Clients
SmartClient
WebClient
NGClient
Methods Summary
void
addBodyParameter(key, value)
Add a body parameter to the request.
void
addHeader(header, value)
Allows setting a header on the request object.
void
addOAuthParameter(key, value)
Add an OAuth parameter, like 'scope', 'realm' or with the 'oauth_' prefix
void
addParameter(key, value)
Add a body or a query string parameter, depending on the request type.
void
addQuerystringParameter(key, value)
Add a query string parameter.
OAuthResponse
execute()
Execute a request that was created with the OAuth service.
void
setPayload(data)
Set body payload.
Methods Details
addBodyParameter(key, value)
Add a body parameter to the request.
String
key
the parameter name
String
value
the parameter value
var postRequest = service.createPostRequest("https://.....");
postRequest.addBodyParameter("param1", "value1");
addHeader(header, value)
Allows setting a header on the request object.
String
header
the header name
String
value
the header value
var getRequest = service.createGetRequest("https://api.linkedin.com/v2/me");
getRequest.addHeader("Accept", "application/json");
addOAuthParameter(key, value)
Add an OAuth parameter, like 'scope', 'realm' or with the 'oauth_' prefix
String
key
one of 'scope', 'realm' or starting with 'oauth_'
String
value
the oauth parameter value
addParameter(key, value)
Add a body or a query string parameter, depending on the request type.
If the request allows a body (POST, PUT, DELETE, PATCH) then it adds it as a body parameter.
Otherwise it is added as a query string parameter.
String
key
the parameter name
String
value
the parameter value
addQuerystringParameter(key, value)
Add a query string parameter.
String
key
the query string parameter name
String
value
the parameter value
execute()
Execute a request that was created with the OAuth service.
var request = service.createRequest(plugins.oauth.RequestType.GET, "https://api.linkedin.com/v2/me");
request.addHeader("Accept", "application/json");
var response = request.execute();
if (response.getCode() == 200) {
var json = response.getAsJSON();
application.output("Name is "+json.firstName);
}
else
{
application.output("ERROR http status "+response.getCode());
application.output(response.getBody())
}
setPayload(data)
Set body payload.
String
data
;
var putRequest = service.createPutRequest("https://graph.microsoft.com/v1.0/me/drive/root:/FolderAA/FileBB.txt:/content");
putRequest.addHeader("Content-Type", "text/plain");
putRequest.setPayload("ABC");