REST API configuration in Blue Prism
Blue Prism has a special setting to facilitate work with the Web API. In this post you will learn how to send parameters to the service and handle its response.
Let’s create a test REST service at https://app.fakejson.com/
Here we can test our web service. It requires you to send JSON containing the token and the data you want to download. In our case, it will be the name and email.
Now we can go to service configuraion in Blue Prism.
Web API Services Configuration
To configure the connection go to the Settings/Objects/Web API Services tab and click Add Service. As a base url set https://app.fakejson.com/
Usually the services are secured. To set the credentials we have to enter Common Authentication and select the type of authentication. We provide the credentials from the Settings/Security/Credentials section. Our test service is publicly available, so we can skip the authentication configuration.
Then we define our action responsible for downloading the data. My action’s name is “Query”.
Now we can go to action’s parameters where we will create a variable for the token.
Then we go to the definition of the Request. It will be almost the same as the request we see in app.fakejson.com/. The only difference is the parameterization of the token. That is why we give its name in square brackets. The actual url of our service is https://app.fakejson.com/q, so as URL Path we give /q.
Set Content-Type = application/json in the Headers
Our object is now ready for use in the Process. Let’s create a new process and test the webservice query. In the token parameter we provide the token value from the website app.fakejson.com. We need Response Content as the output parameter.
We get a response from the weservice.
You can change the response to a collection using the Utility – JSON object or use the option of configuring our Web API object adding output parameters. To do this go to the Response tab.
Now our output parameters will be visible in the Process.
The disadvantage of the solution shown is static JSON sent to the API. The Web API configuration in Blue Prism also allows to handle dynamically built queries, but I’ll leave it for a separate post.