Using SOAP UI to play with SM RESTful Webservices

smartbear-soapui-color-horizontal-version_logo

The RESTful API framwork is supported from SM 9.32 which provides  lightweight queries and operations on Service Manager data via a single URI. Using the
REST API Framework you can create an application that can perform Create, Read, Update, and Delete actions on Service Manager objects.

During the work, I have used one app called SOAP UI to interact with SM via WS, so this article will share about one of our case that use SOAP UI to update the tickets in SM

Lets check it out:

Firstly, make sure your SM server has enable the support for RESTful WS:

  • restaccessviabrowser:1 in sm.ini
  • RESTful API capability in operator table
  • RESTful checkbox checked in Tailoring > WS configuration

Open SOAP UI, create new REST project.
Input the following information:

Endpoint url: http://<SM server>:<port>
Resource:

For IM (probsummary):

/SM/9/rest/incidents/<ticketID>

For SD (incidents):

/SM/9/rest/interactions/<ticketID>

For Change (cm3r)

/SM/9/rest/changes/<ticketID>

Media Type: application/json

code:

IM:

// here you need to input all the required fields to pass the validation when sending the request to SM, the caption of each field, you can check at Tailoring > Webservice configuration > tab Fields. Example the code is:

{
“Incident”: {
“JournalUpdates” : [ “some update” ],
“Impact”: “1”
}
}

SD:

{
“Interaction”: {
“JournalUpdates” : [ “some update” ],
“Impact”: “1”
}
}

Change:

{
“Change”: {
“JournalUpdates” : [ “some update” ],
“Impact”: “1”
}
}

 

Method: PUT

After filling all the above values, click at play icon button to send the request, wait for a while. If the request is succeeded, the result will be:

<Messages>
<e>Incident record updated.</e>
<e>US/Mountain 09/05/16 03:58:27: Incident IMxxxx has been updated by falcon</e>
</Messages>
<ReturnCode>0</ReturnCode>

The return code 0 means your request is succeeded. There are severals return codes that can be replied after executing the WS request, but we will talk about it later.

Quick notes: 

REST APIs generally format the responses in JSON or XML. Both formats are well supported, with libraries available in most any modern programming language. Using one of these libraries, you’ll find it relatively straightforward to convert the response into an object that you can manipulate in your application.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s