Add a body parameter to the request.
Parameters
Supported Clients
Sample
var postRequest = service.createPostRequest("https://....."); postRequest.addBodyParameter("param1", "value1");
Allows setting a header on the request object.
var getRequest = service.createGetRequest("https://api.linkedin.com/v2/me"); getRequest.addHeader("Accept", "application/json");
Add an OAuth parameter, like 'scope', 'realm' or with the 'oauth_' prefix
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.
Add a query string parameter.
Execute a request that was created with the OAuth service.
Returns
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()) }
Set body payload.
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");