RESTful Syntax

A RESTful query allows you to send a request or execute an operation by sending a single Universal Resource Identifier (URI) space to Service Management. In general, the format for the URI resembles the following:

  • http://{host}:{port}/{initialPath}

This example uses the following placeholders:

  • The {host} placeholder indicates the host or domain name on which the service is available.
  • The {port} placeholder indicates the TCP port number on which the service is available.
  • The {initialPath} placeholder indicates any initial path that is part of the URI for a given deployment. This might be the path to the deployment point on the given server. This value should start with /SM/9/rest.

Note If the URL contains “\”, it should be replaced with “%5C” before encoding. For example, for Adobe\Reader, it should be replaced with Adobe%5CReader, and then be encoded as Adobe%255CReader.

If the URL contains“/”, it should be replaced with “%2F” first before encoding. For example, for Adobe/Reader, it should be replaced with Adobe%2FReader, and then be encoded as Adobe%252FReader.

Resource Types

The Rest API Framework in Service Management allows you to perform standard CRUD operations on resources. URI endpoints for resources are roughly divided into the following resource types:

  • Resource Collection
  • Resource Instance
  • Resource with Actions
  • Attachment Collection
  • Attachment Instance

URI Structure

The following table describes the structure of URIs that can be used in the Rest API Framework.

URI Resource Comments Example
/ Service Document This is the service document for an entire business service. Only the GET method is supported. http://{host}:{port}/SM/9/rest
/{resources} Resource Collection This is the collection resources. Only the GET and POST methods are supported. http://{host}:{port}/SM/9/rest/incidents
/{resources}/{key} Resource Instance This is an individual resource.

http://{host}:{port}/SM/9/rest/incidents/IM10001

If with multiple keys, it should be {key1}/{key2}/{key3}. If one of the key value is null, it should look like: {key1}/null/{key3}

/{resources}/{key}/attachments Attachments Collection This is the attachment list for an individual resource. http:/{host}:{port}/SM/9/rest/incidents/IM10001/attachments
/{resources}/{key}/attachments/{attachment-id} Attachment This is an individual attachment. http://{host}:{port}/SM/9/rest/incidents/IM10002/attachments/cid:51dd0b6d0002c0042075d798
/{resources}/{key}/action/{action} Resource With Actions Only the POST method is supported.

POST http://{host}:{port}/SM/9/rest/incidents/IM10134/action/reopen

This table uses the following placeholders:

  • The {resources} placeholder represents the resource key of the individual object.
  • The {attachment-id} placeholder represents the ID of the attachment for an individual resource.
  • The {key} placeholder represents any unique key specified in the extaccess record.
  • The {action} placeholder represents any action specified in the Allowed Actions tab of the External Access Definition. It must be lower case. For example, if the action in the Allowed Actions tab is "Reopen", the value of {action} should be "reopen".
  • action, attachments and view are keywords that are used in the URI.