calling a web service with API keys

Hi,
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?

OriginalPostID-233747

  Discussion posts and replies are publicly visible

Parents
  • 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).
    Eg:
    a!httpQuery(
    url: "http://xyz.com",
    queryParameters: {
    a!httpQueryParameter(name: "username", value: "xyz"),
    a!httpQueryParameter(name: "password", value: "yourpwd")
    },
    headers:{/*pass headers here */}
    )
Reply
  • 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).
    Eg:
    a!httpQuery(
    url: "http://xyz.com",
    queryParameters: {
    a!httpQueryParameter(name: "username", value: "xyz"),
    a!httpQueryParameter(name: "password", value: "yourpwd")
    },
    headers:{/*pass headers here */}
    )
Children
No Data