Classes
Members
# readonly METHODS
Supported HTTP methods.
GET / POST / PUT / DELETE / PATCH
Example
// call REST service
const url = `${ctx.getServiceUrl(InfohubContext.SERVICE.USR)}/${cntx.getScope()}/usergroups?filter=$userid ~eq~ '${userid}'&members=info`;
let resp = RestServices.makeApiCall( ctx.getToken(), RestServices.METHODS.GET , url);
Methods
# async static makeApiCall(token, method, fullpath, body, acceptType, contentType, responseType) → {Promise.<RestResponse>}
Make HTTP API call. Uses 'fetch' to execute the call.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
token |
string
|
The access token to use for the API call |
|
method |
string
|
HTTP method |
|
fullpath |
string
|
URL of endpoint |
|
body |
Object
|
null | = null, Request Body, Could be null for GET |
acceptType |
string
|
application/json | = "application/json", Accept: acceptType // Accept Header |
contentType |
string
|
application/json | = "application/json" Content-Type header |
responseType |
string
|
auto | "auto" // "auto" | "json" | "text" | "blob" | "arrayBuffer" Response type |
Promise.<RestResponse>
Example
//
const url = `${ctx.getServiceUrl(InfohubContext.SERVICE.USR)}/${ctx.getScope()}/usergroups?filter=$userid ~eq~ '${userid}'&members=info`;
let resp = RestServices.makeApiCall( ctx.getToken(), RestServices.METHODS.GET , url);