REST webservices and API key
Dear omniscient SCN
I have the situation that I have to integrate an external webservice using REST where the webservice requires registration using an api key.
Now the SDK documentation, chapter "Integrate an External Web Service Using REST" wrote:
If the service you are calling requires authentication, you can define the required identifiers as API keys. The values of the API keys are maintained in the communication arrangement. You cannot use API keys with non-secure URLs (HTTP). To define an API key, do the following:
- Enter the key in the API Key field.
- Click the Placeholder for API Key in Script File field to the right of the API Key field.
The placeholder is generated, which you can use in the script file to build the Web service request.
So, according to SDK documenation, I can use a placeholder somewhere inside the script file to build the Web service request.
Now my question:
How does one use this placeholder using a REST webservice?
My current code is:
// Communication details
var scenarioName = "RESTWebServiceTest";
var serviceName = "RESTWebServiceIntegrationTEST";
urlPath = "api?apiKey=&RESTWebServiceTest_ApiKey&";
// Execute webservice call
var ws_result = WebServiceUtilities.ExecuteRESTService(this.ScenarioName, this.ServiceName, "POST", urlPath, this.UrlParameter, this.HeaderParameter, "text/plain", this.Content);
If I replace the place holder with the actual api key, everything is working fine.
However the purpose of the placeholder is be able to set an api key individually in the communication arrangement.
So how do I use the placeholder correctly?
With SOAP webservices I do have a fair understanding how this is supposed to work since I do have a webservice object where I am building the webservice request and set the api key.
However with REST webservices there is no such thing as a webservice request object, execution is triggered using a Library call.
So, Horst, Fred, etc:
Thanks a lot,
Custom development with all4cloud.de