calling a web service with API keys

In the past we have used the "Call Web Service" smart service to call a web service and passed a username and password to authenticate.

A vendor that we are working with has web services that we would need to call but they said they use an "API key" to make the API calls.

Can we pass an "API key" using the smart service in Appian?


  Discussion posts and replies are publicly visible

  • If you were using "Call Web Service" smart service - it implies that you were consuming a SOAP based Web Service - and were authenticating using username/password as you mentioned.
    If the new vendor has a "API Key" to authenticate, it means the authentication mechanism is different. Can you let us know if it is SOAP or REST based web-service that you are going to consume?
    As far as I know, in RESTful webservices, the API is generally passed as a query parameter or as a header. Most of the webservices use a query parameter for the API key.
    So, it depends on - whether your webservice is SOAP or REST based, and whether the API key needs to be passed in the Query parameters or in the Headers. You will need to ask the vendor who is providing the web services for more details.

    If it is a REST based webservice, you can consider using the "HTTP Query" smart service or the a!httpQuery() function on SAIL forms.
  • Hi Chetan, the vendor provided an API and in its description, it is something like this:
    how do I configure this in httpquery function?
  • should I use in httpqueryparameter or is there any other way?
  • Hi Ankita, It seems that for your web service, you need to pass the username and password in the body. So, first try using the "Http Query" smart service. In the data tab, it has "Request Body" input(text type). You can pass the username and password in the format they have given.
    Eg: grant_type=password&username=ankita&password=1234

    The a!httpQuery() function does not have option to specify the body.(It does not allow POSt requests as of Appian 7.11, need to check for other versions..). Check if your Appian version has an option for body. If it has you can pass it.

    Would also suggest passing the username and password in queryParameters(although I think in your case, you need to pass it in the body - but you can still try).
    url: "",
    queryParameters: {
    a!httpQueryParameter(name: "username", value: "xyz"),
    a!httpQueryParameter(name: "password", value: "yourpwd")
    headers:{/*pass headers here */}
  • If you need to POST in the body, you can use the a!httpWrite() function. It is similar to a!httpquery() function. Yes, I think a!httpWrite() would be appropriate for you. In it, you can specify the body.
  • a!httpWrite() is a binder function. means, user has to perform some action to activate the binder function.
  • Yes, it will need to be used on SAIL form, not possible to just use it in an expression rule.