REST Call with Binary Response

Steps

  1. Create a project rest_call_binary_project.
  2. Then create a JavaScript service named get_call_binary.js.
  3. Within the service code, enter the following content:

GET Call

1
2
3
4
5
6
7
8
9
10
11
var client = require('http/v3/client');
var response = require('http/v3/response');

var httpResponse = client.get('https://raw.githubusercontent.com/eclipse/dirigible/master/NOTICE.txt', {'binary': true});

response.println(httpResponse.statusMessage);
response.println(JSON.stringify(httpResponse.data));
response.flush();
response.close();


For more information, see the API documentation.

Edit