cancel
Showing results for 
Search instead for 
Did you mean: 

API to interact with Blue Prism Control Room

ramprasadvaddep
Level 3
Hi,

can we access the Blue prism control room from other tools like SOAPUI to trigger the process and also get the information like available resources and session logs details like how processes is available and to read and control the bots. Please let me know how to configure and proceed if any documentation is available provide me.

Many Thanks!
Ramprasad

------------------------------
ramprasad vaddepally
------------------------------
18 REPLIES 18

@PoojaSamudre - Are you sure the values of your Base URL and Oauth2 URL are correct? Are you running this test on a machine that has everything installed locally?

@Bruce Liu - Any thoughts?

Cheers,
​​

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi Pooja,

The most common cause for 401 is that your service account has not received sufficient permission in Blue Prism. Using an Interactive Client, you should find your service account under Security > Users screen with a yellow lock to the left. This user is brought in by the Authentication Server automatically and should be configured to provide necessary access to key Blue Prism resources as if a human user. In your case permissions related to work queue should apply. If you are testiing, you would be able to get away by just granting the maximum permissioin possible for the user so you can be sure, i.e. granting the user "System Administrators" role.

------------------------------
Bruce Liu
Senior Product Consultant, Professional Services
Blue Prism
Australia/Sydney
------------------------------

Hi Eric and Bruce ,

The values of Base URL and Oauth2 URL are correct and I am running this test on Separate lab environment where everything installed locally. Also I have tried accessing APIs from Client machine.

Yes , Earlier my BP API service account didn't had sufficient permissions, Now for BP API service account I granted "System Administrators" role as you can see in below snapshot. After granting all permissions I have restarted IIS Website. Still I am getting 401 unauthorized error.

13870.png
Thank you for getting back to me.



------------------------------
Pooja Samudre
------------------------------

Hi Pooja,

Now looking at the screenshots from you last few posts, I am uncertain on things you did there, it was not how you meant to use the DX asset.

The following screen should be all you need to configure the asset to work. BPAPI_CLIENTID should be set to the exact name of the service account you created, which is also the same as the account with yellow key you can see from within Blue Prism user screen. You seem to be using many different values over time. I cannot be certain which is actually your API service account, and if sufficient permissions have been granted to it.

13880.png
The asset should also have variables set so you do not need to enter any value, for example, on the next screen. But you chose to override the values here, and somehow you used "AuthenticationServer" on Client ID, which just does not make sense. This should be set to your API service account name instead, and if you have been using the asset in the way it is designed, you would have set that in the previous screen, against variable BPAPI_CLIENTID.

13882.png
My assessment on your situation is that you did not plug in the authentication values and because of that you were getting 401. In this very case, 401 does not mean insufficient permissions, but rather incorrect credentials.

I would think you should check your service account, make sure you are using the right service account name for the asset. Once done, consider reimport the DX asset by overwriting the existing one, followed by reconfiguration of all parameters according the instructions given in the user guide and see if it works for you.

Lastly, you do not need to reset your IIS after making any changes anywhere. By design, obtaining a new oAuth 2.0 token is sufficient for the API services to take into consideration of updated permissions you have set in Blue Prism against your service account.

Hope this helps.

------------------------------
Bruce Liu
Senior Product Consultant, Professional Services
Blue Prism
Australia/Sydney
------------------------------

Hi Bruce,

Thanks a lot that was really helpful. I got the response.

------------------------------
Pooja Samudre
------------------------------

Hi,

I am trying to access API end points using python code, When trying to get access token getting 400 response, but same I am able to do with postman.

Can I get more details on what will be the headers or json data we can pass for authorization using client id and client secret.

Sample code i am using -

def collect_access_token(host_name,oauth2_url,client_id,client_secret):
      header = {'Content-Type': 'application/json; charset=utf-8'}
      data = {"grant_type":"client_credentials","BPAPI_OAUTH2URL":oauth2_url,"BPAPI_CLIENTID":client_id,"CLIENT_SECRET":client_secret,"scope":"bp-api "}
      print("Getting response")
      response = requests.post(host_name, data=data,headers=header, verify = False)
      print(response)

I am refering to this document - https://bpdocs.blueprism.com/bp-7-0/en-us/api-spec.html
Also, can i get documentation link on how i can use  blueprism APIs outside of postman or using python or any other programming language.

Thanks in advance.

Pooja Samudre

------------------------------
Pooja Samudre
------------------------------

@PoojaSamudre,

If you are able to use the BP REST API from Postman have you tried looking at the code that Postman can generate for any action? There's an option to select the language you want to the code generated in and Python is one of the options. Here's an example of getting the work queues using Python http.client.

13917.png
Cheers,




------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi Pooja,

Please refer to the following page to get a clear understanding how OAuth2 Client Credential flow is implemented.

https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/

You will then notice you have specified your request body incorrectly. It is expecting a plain string like

grant_type=client_credentials&client_id=xxxxxxxxxx&client_secret=xxxxxxxxxx

But you have specified a Python dictionary

{"grant_type":"client_credentials","BPAPI_OAUTH2URL":oauth2_url,"BPAPI_CLIENTID":client_id,"CLIENT_SECRET":client_secret,"scope":"bp-api "}

Your header is also incorrect, it cannot be application/json as the body is not in Json format. If you are supplying any header, you should have the following

Content-Type: application/x-www-form-urlencoded

But you may even get away with leaving header completely unfilled for this Post request.

Hope you get the idea.

------------------------------
Bruce Liu
Senior Product Consultant, Professional Services
Blue Prism
Australia/Sydney
------------------------------

Hi Eric, Bruce,

@Eric - I didn't knew about that option, Thanks for letting me know.

@Bruce - Now I have clear understanding how OAuth2 Client Credential works,  that was really helpful.


Thanks for help 🙂



​​​

------------------------------
Pooja Samudre
------------------------------