ExecuteHttpRequest
This function executes an HTTP request. It supports HTTP methods GET, POST, PATCH, PUT and DELETE.
This function is valid only in TurboIntegrator processes and only on TM1 Database 12.
The HTTP response is cached in memory. A response consists of a status code, a number of headers and a body, any of which can be queried by using the corresponding TurboIntegrator functions: HttpResponseGetStatusCode, HttpResponseGetHeader, and HttpResponseGetBody.
The TM1 Database 12 only keeps one HTTP response at a time. A new successful HTTP request execution update and overwrites the cached response.
By default, the TM1 Database 12 keeps only the first 100 KB of a response body and discards the rest. This prevents running out of evaluation memory for strings. If the response body is large than 100 KB, you can use the -o optional argument to write the response to a file.
For convenience, the engine reuses the cookie it found in the previous responses in new requests when the Cookie header is absent.
Syntax
ExecuteHttpRequest(method, URL, option1, option2,
...);
Argument |
Description |
---|---|
method | The method of the HTTP request. Supported methods are |
URL | The URL where you want to execute the request. The URL must use the HTTP or HTTPS protocol. |
option1, option2, ... | You can use these options in the request:
|
Example
# Get the cube rules from a remote TM1 server
ExecuteHttpRequest(
'GET',
'https://ibmcloud:11838/api/v1/Cubes(''A'')/Rules',
'-u admin:',
'-o response.json'
'-c tm1_cert.perm' );
rules = HttpResponseGetBody();
# Update the rules of a cube on a remote TM1 server
ExecuteHttpRequest(
'PATCH',
'https://ibmcloud:11838/api/v1/Cubes(''A'')',
'-u admin:',
'-h Content-Type:application/json',
'-d { "Rules" : "" }',
'-k' );
status_code = HttpResponseGetStatusCode();