cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a Restful API

KenExton
Level 2
​So I am trying to figure out how to create a Restful API object in Blue Prism that can connect to ServiceNow. I want to create GET, POST and PUT calls. I figure out that I should use the Webservices - REST object with a Action <get/post/put> to do this along with the needed VBOs. What I cannot figure out is how to pass the request user credentials in. The Webservices - REST object only takes in one parameter, the url. If I instead try to use a HTTP object and give it a username and password ServiceNow will still not allow the request to go thru.

------------------------------
Ken Exton
Software Engineer
Harris
America/New_York
------------------------------
9 REPLIES 9

DaveMorris
Level 14
What I have found in making REST API calls is that the Webservices - REST object only works in a handful of situations. Some APIs will require some particular (maybe small) difference such as an extra field or two in the header with a specific syntax. My suggestion would be to use the HTTP object directly as you're doing, but find out exactly what format the endpoint is expecting. I helped a bit on a project that made REST API calls to ServiceNow, but I cannot remember any specifics. I suspect this may be different from one company to another, but I remember we had to set up the username/password and proxy URL in addition to whatever credentials for ServiceNow. Are you getting any response from the server or is it just rejected entirely? Like, does it indicate it is an authentication failure or could it still be a message formatting failure?

------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

​Thank you for the reply. Actually I do get a response when using the Webservices - REST object stating that an error was received due to bad credentials which makes sense considering the Webservices - REST object has no place to put them in. I tried using the HTTP object directly like you listed since the Webservices - REST object ends up calling it anyway but did not have much success there either. I am going to give the HTTP object another try. You might be right about the proxy url too, have to check on that part.

------------------------------
Ken Exton
Software Engineer
Harris
America/New_York
------------------------------

​Just an Idea, maybe it helps or maybe it makes no sense 🙂

In our org. we needed to allow and give special roles to the user to be able use API (SOAP etc.)  as well some special access to speific tables.
Utility HTTP  Request (GET) was working OK as well, at least for getting ticket attachments information. For work with the tickets i suggest using SOAP webservice.

------------------------------
Pavel Král
RPA Specialist
MANN+HUMMEL Service s.r.o
------------------------------

Just curious if your ServiceNow process require an unique ID every time you create a single ticket?
And then need another unique when creating the second ticket.
The error message is like this:The "Unique ID" provided is not unique and was used in a previous webservice transaction
I am able to generate the next unique ID, but not sure how to reset/revoke the ServiceNow API session.

------------------------------
F L
Tech
America/New_York
------------------------------

Hi, Ken,

can you post some link to documentation about REST and SNOW? We did a project to integrate with SNOW but we used SOAP web service calls which worked fine. Not aware there would be a REST implementation.

Regards,

Zdenek

------------------------------
Zdeněk Kabátek
Head of Professional Services
NEOOPS
Europe/Prague
------------------------------

Hi,
no in our case using SOAP to create a ticket , there is no need for unique ID as the ID wil lbe return from the SOAP action. So if we use create ticket, the Sys ID is return.
Did you check the manbals for BluePrism how to set-up SOAP via WSDL? like https://myinstance.service-now.com/incident.do?WSDL (incident.do can be supplement with any table name you are using in SNOW) But you will need some account setup with access to these WSDL files.

https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/integrate/inbound_soap/concept/c_WSDL.html



------------------------------
Pavel Král
RPA Specialist
MANN+HUMMEL Service s.r.o
------------------------------

AndrzejKaczor
Level 4
If you're intersted, then below is my code that is used for Service-Now REST Get.

Dim request As WebRequest = WebRequest.Create(REST_URI)

request.Credentials = new NetworkCredential(SNOW_Username, SNOW_Password)
request.Method = "GET"

Dim response As WebResponse = request.GetResponse
Dim responseStream As IO.Stream = response.GetResponseStream
Dim sr As New IO.StreamReader(responseStream)', Text.Encoding.UTF32)

resultData = sr.ReadToEnd

Oh, that's a post from April.

------------------------------
Andrzej Kaczor
RPA Dev
Arla Foods Ltd.
Europe/London
------------------------------

ChrisHogan
Staff
Staff
If you are on Blue Prism v6.4 or later you should take a look at Web APIs. Info can be found here:
https://portal.blueprism.com/system/files/documents/v6.4%20User%20Guide%20-%20Web%20APIs_2.pdf

They make it very easy to consume external REST services, and support most common authentication mechanisms (Basic, Token , OAuth)

------------------------------
Chris Hogan
Senior Ecosystem Architect
Blue Prism
------------------------------

Yeah we've already read through it and can use this 😊 

 



------Original Message------

If you are on Blue Prism v6.4 or later you should take a look at Web APIs. Info can be found here:
https://portal.blueprism.com/system/files/documents/v6.4%20User%20Guide%20-%20Web%20APIs_2.pdf

They make it very easy to consume external REST services, and support most common authentication mechanisms (Basic, Token , OAuth)

------------------------------
Chris Hogan
Senior Ecosystem Architect
Blue Prism
------------------------------