REST.get

From RPTools Wiki
Revision as of 04:24, 16 March 2019 by Phergus (talk | contribs)
Jump to navigation Jump to search

REST.get() Function

 Note: This function can only be used in a Trusted Macro

Introduced in version 1.5
Perform an HTTP get request to the specified URL to retrieve a resource or information.

Usage

REST.get(url, getFullResponse)

Parameters

  • url -
  • getFullResponse - Boolean (0:1) to get full response.

Returns

HTTP response as JSON (if full response) or server response, usually JSON but can be XML, HTML, or other formats.

Example

Get the specified user.
[h: baseURL = "https://reqres.in"]
[h: path = "/api/users/2"]

[h: response = REST.get(baseURL + path, 0)]

<br>
Response: [r: baseURL + path]
<pre>
[r: json.indent(response, 2)]
</pre>

<br><br>

[h: response = REST.get(baseURL + path, 1)]

<br>
Full Response: [r: baseURL + path]
<pre>
[r: json.indent(response, 2)]
</pre>

Returns:

TEXT HERE

See Also

Version Changes

  • 1.5 - Added to main MapTool build.