avatar image
Former Member

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:

  1. Enter the key in the API Key field.
  2. 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";

var urlPath;

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:

Any ideas?

Thanks a lot,

Ludger

--

Custom development with all4cloud.de

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jul 29, 2016 at 10:02 AM

    Hi,

    You can generate API Key in the communiation arrangement and it should work automatically, that is because WebServiceUtilities.ExecuteRESTService implementation would get it from the communication arrangement

    Thanks, Pradeep.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Victor,

      Since changed job meanwhile, I do not have the user I originally created this thread with.

      Therefore i cannot mark this as correct (as well as I do not need the solution anymore).

      Best regards,

      Ludger

  • avatar image
    Former Member
    Nov 04, 2015 at 10:20 AM

    No-one has any experience yet?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Ludger Buenger

      Hi Ludger,

      I'm having the same issue described by Navin.

      Can you please share the steps you done to use the API key inside ABSL script?

      Thanks in advance,

      Fernando

  • Jul 26, 2016 at 10:19 PM

    Hello Ludger,

    Were you able to find the solution?

    Best regards,

    Victor Silva

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Ludger Buenger

      Hi Ludger,

      Just to clarify. I have used the approach suggested by Kumar below and it works.

      We included the API token placeholder as a header parameter. During debug, you never is able to see the placeholder converted, but once the REST service is triggered you can see the API Key converted.

      Thanks a lot for the support guys!

      Fernando

Skip to Content