Procedure
-
In your HTML page, add the following
meta
tag to link it with Talend Cloud API Tester.<meta name="dhc-aware-page" data-indicator-element-id="<id_element>" data-console-debug="<allow-debug-logs>" >
Parameters information Parameter Type Required Description name
String Yes The value must be dhc-aware-page
.data-indicator-element-id
String No Specifies the id of the element Talend Cloud API Tester will inject in your page to let it know it is available. The default value is dhcInfo
.data-console-debug
Boolean No If the value is true
, debug information will be printed into the browser's JavaScript console (on your page). The default value isfalse
.The injected element looks like this:
<script id="my-id" client-indicator="my-id" type="dhc/info"> {"dhcVersion":"23.0.1","extensionId":"aejoelaoggembcahagimdiliamlcdmfm"} </script>
-
Call
window.postMessage
with the following message object to instruct Talend Cloud API Tester to open.{ target : "<extension_id>", type : "<type>", payloadType: "<type_of_payload>", payload : "<payload>", shouldReplaceOriginTab: <shouldReplaceOriginTab> }
Parameters information Parameter Type Required Description target
String Yes The ID of the Talend Cloud API Tester extension. It can be obtained from the Talend Cloud API Tester indicator element. For example:
JSON.parse(document.querySelector('script[type="dhc/info"]').innerText).extensionId
Or if you set
data-indicator-element-id
tomy-id
in yourmeta
tag:JSON.parse(document.getElementById('my-id').innerText).extensionId
type
String Yes The type of the message, instructs Talend Cloud API Tester on what action it should perform.The possible values are
openRequest
oropenExtension
(to open without loading a request).payloadType
String Yes The type of the payload to load in Talend Cloud API Tester. Possible values: apiTester
if thetype
parameter is set toopenRequest
ornone
if it isopenExtension
.payload
String Only if the type
isopenRequest
The request to load if type
is set toopenRequest
. See the example below.shouldReplaceOriginTab
Boolean No Indicates whether Talend Cloud API Tester should be loaded in the tab sending window.postMessage
or in a new tab. The default value isfalse
.Example
{ "name": "Post example on HTTP Bin", "headers": [ { "enabled": true, "name": "Content-Type", "value": "application/json" } ], "type": "Request", "method": { "requestBody": true, "link": "", "name": "POST" }, "body": { "autoSetLength": true, "textBody": "{\n \"lastname\": \"Eastwood\",\n \"firstname\": \"Clint\"\n}", "bodyType": "Text" }, "headersType": "Form", "uri": { "path": "httpbin.org/post", "query": { "delimiter": "&", "items": [ { "enabled": true, "name": "details", "value": "full" } ] }, "scheme": { "secure": true, "name": "https", "version": "V11" } } }