1.6 Request API

1.6.1 Create Incident / Change Request / Service Request

Syntax

createIncident (String itemNumber, String classificationId, String subject, String description, HashMap customFieldValues)

createChangeRequest (String itemNumber, String classificationId, String subject, String description, HashMap customFieldValues)

createServiceRequest (String itemNumber, String classificationId, String subject, String description, HashMap customFieldValues)

Description

This API is used to create an Incident, Change Request or Service Request for the logged in User. Simply supply the function with the number of the Item you wish to raise an Incident, Change or Service Request against, the ID of the Classification the Incident falls under and a text description of the problem.

If custom fields are enabled for the Request type being created, these values need to be passed into the customFieldValues HashMap, with keys custom1 through to custom5.

The Item Number and Classification must exist in this function’s derived lists for the Request to be successfully created.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item Number used for the basis of this request.

  2. classificationId: The Item classification Id to use for this request. Use getClassifications(String itemNumber) for a list of classifications available for this item.

  3. subject: The subject line of this new request.

  4. description: The description of this request.

  5. customFieldValues: A HashMap of values with keys custom1 through custom5.

NOTE:All three arguments (‘itemNumber,’ ‘classificationNumber’ and ‘Description’) are required. Omitting any of the three will result in failure and a message explaining the circumstances.

Return Value

This API returns a HashMap containing two fields: success and message.

The value returned in the success field will be a string representation of a boolean (true or false) indicating whether or not the Request’s creation attempt was successful.If a Request was successfully created (that is the success field is true), the value returned i the message field will be a String representation of the new Request’s ID number.If the process fails for any reason (that is. the success field is false), the message field will contain a text message explaining why the failure occurred.

1.6.2 Create Incident / Change Request / Service Request (for a Customer)

Syntax

createIncidentCustomer (String customerId, String itemNumber, String classificationId, String subject, String description, HashMap customFieldValues)

createIncidentDates(String customerId, String itemNumber, String classificationId, String subject, String description, HashMap customFieldValues, String reportDate, String closeDate, String closingTechId)

createChangeRequestCustomer (String customerId, String itemNumber, String classificationId, String subject, String description, HashMap customFieldValues)

createServiceRequestCustomer (String customerId, String itemNumber, String classificationId, String subject, String description, HashMap customFieldValues)

Description

This API is used to create an Incident, Change Request or Service Request for a Customer created from the createCustomer() function. Provide the Customer ID, the Item Number you wish to raise the Request against, the ID of the Classification the Request falls under and a text description of the problem.

If custom fields are enabled for the Request type being created, these values need to be passed into the customFieldValues HashMap, with keys custom1 through to custom5.

The Item Number and Classification must exist in this function’s derived lists for the Request to be successfully created.

Parameters

The following are the input parameters for this API:

  1. customerId: The unique Customer Id to create the request against.

  2. itemNumber: The unique Item Number used for the basis of this request.

  3. classificationId: The Item classification Id to use for this request. Use getClassifications(String itemNumber) for a list of classifications available for this item.

  4. subject: The subject line of this new request.

  5. description: The description of this request.

  6. customFieldValues: A HashMap of values with keys custom1 through custom5.

  7. reportDate: The date the request will be initially recorded. Date must be formatted as yyyy-mm-dd hh:mm.

  8. closeDate: The date the request should be recorded as closed. Date must be formatted as yyyy-mm-dd hh:mm.

  9. closingTechId: The id of the technician that closed the request. The closingTechId if set will be used in conjunction with the closeDate to set the technician to credit for the closure.

NOTE:All four arguments (‘customerId’, ‘itemNumber,’ ‘classificationNumber’ and ‘Description’) are required.

reportDate and closeDate must be formatted as ‘yyyy-mm-dd hh:mm’ strings to be correctly parsed and will set the dates the request was logged and closed, setting the appropriate times against the SLA. This can be combined with adding incident notes to import legacy data into the system.

Return Value

This API returns a HashMap containing two fields: success and message.

The value returned in the success field will be a string representation of a boolean (true or false) indicating whether or not the Request’s creation attempt was successful.If a Request was successfully created (that is the success field is true), the value returned i the message field will be a String representation of the new Incidents’s ID number.

If the process fails for any reason (that is. the success field is false), the message field will contain a text message explaining why the failure occurred.

1.6.3 Get Classifications

Syntax

getClassifications (String itemNumber)

Description

This API returns a list of all the classifications that exist in the system for the selected item type.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique ItemNumber to retrieve classifications from.

Return Value

This API returns a HashMap that contains the list of Classification IDs as field names. Each field has a String value containing the name of the Classification. In Service Desk, Classifications are grouped into a hierarchical tree. The list returned by ‘getClassifications’ will be ordered according to the hierarchical tree as it would appear in the application.

In the event that no Classifications are found, only the ‘message’ field will be present and will contain a text message explaining that no Classifications were found.

Once you have the names of the fields (iter.next() – Classification ID numbers in the above example) you can then use them to look up the names of the Classifications associated with them in the HashMap.

1.6.4 Get Subject

Syntax

getSubject (String requestId)

Description

This API returns a HashMap containing the ‘subject’ for the provided Request ID.

Parameters

The following are the input parameters for this API:

  1. requestId: The unique id of the request to retrieve subject from.

Return Value

None

1.6.5 Get Description

Syntax

getDescription (String requestId)

Description

This API returns a HashMap containing the ‘description’ for the provided Request ID.

Parameters

The following are the input parameters for this API:

  1. requestId: The unique of the request to retrieve description from.

Return Value

None

1.6.6 Get Request Count By Status

Syntax

getRequestCountByStatus (String statusId)

Description

This API returns a HashMap containing the ‘requestCount’ for the provided Status ID.

Parameters

The following are the input parameters for this API:

  1. statusId: The id of the status to retrieve the request count for. This is the a synonym for the workflow status.

Return Value

None

1.6.7 Get Requests By Status

Syntax

getRequestsByStatus (String statusId, String pageNo)

Description

This API returns a HashMap containing the ‘requestId’ as a key and the description as the value, for all Requests in a Status with the given statusId. The returned HashMap also contains the success flag to deal with Requests that can’t be processed for various reasons, along with a message to state the reason.

Parameters

The following are the input parameters for this API:

  1. statusId: The id of the status to return requests against.

  2. pageNo: The page number to retrieve. These are returned 100 requests at a time.

Return Value

None

1.6.8 Get Request Detail

Syntax

getRequestDetail (String requestId)

Description

This API returns a HashMap containing various fields that make up the request. The returned HashMap also contains the success flag to deal with requests that can’t be processed for various reasons, along with a message to state the reason.

Parameters

The following are the input parameters for this API:

  1. requestId: The unique request Id of the request to return details from.

Return Value

The API returns a HashMap contains a success flag and the values for the keys of the given fields:

Key

Description

customer

Customers full name

customerId

Customer ID

customerPhone

Customers contact phone number.

orgUnit

Organizational Unit display name

orgUnitId

Organizational Unit ID

item

Configuration Item name

itemId

Configuration Item ID

itemNumber

Configuration Item Number as displayed to users.

itemStatus

Configuration Item status.

itemCriticality

Configuration Item criticality.

status

Request status

statusId

Request status ID

statusEntry

If the request is at an entry state of the workflow

statusExit

If the request is at an exit state of the workflow

statusIsApproval

If the request is in an approval status state on the workflow

classification

Request classification

classificationId

Request classification ID

impact

Request impact

impactId

Request impact ID

urgency

Request urgency

urgencyId

Request urgency ID

priorityType

Request priority

priorityTypeId

Request priority ID

technician

Assigned Technician

team

Assigned Team

teamId

Assigned Team ID

dateCreated

Request creation date (MM/dd/yyyy HH:mm)

dateClosed

Request closed date (MM/dd/yyyy HH:mm)

dateDue

Request due date (MM/dd/yyyy HH:mm)

lastUpdated

Date request was last updated (MM/dd/yyyy HH:mm)

type

Process type

workflow

The current workflow

workflowId

The current workflow Id

editable

If the request is editable by the current user based on team membership and other permissions

1.6.9 Get Public Notes

Syntax

getPublicNotes (String requestId)

Description

This API returns a list of all the public Notes for a given requestId. The returned HashMap contains the Note ID and Note Date.

Parameters

The following are the input parameters for this API:

  1. requestId: The unique Request Id from which to retrieve notes.

Return Value

None

1.6.10 Get Notes

Syntax

getNotes (String requestId)

Description

This API returns a list of all the Notes for a given requestId. The returned HashMap contains the Note ID and Note Date.

Parameters

The following are the input parameters for this API:

  1. requestId: The unique Request Id from which to retrieve notes.

Return Value

None

1.6.11 Get Notes Detail

Syntax

getNotesDetail (String requestId, int pageSize, int pageNumber)

Description

This API returns a list of all the Notes for a given requestId. The page size and page number can also be specified. The returned HashMap contains the Note ID, Note Date, Private Note Flag, Author and the Note Content.

Parameters

The following are the input parameters for this API:

  1. requestId: The unique Request Id from which to retrieve notes.

  2. pageSize: The number of elements to return for each page.

  3. pageNumber: The page number to retrieve with given pageSize.

Return Value

None

1.6.12 Get Note Content

Syntax

getNoteContent (String requestId, String noteId)

Description

This API returns the content of the Note for the provided Request ID and Note ID.

Parameters

The following are the input parameters for this API:

  1. requestId: The unique Request Id from which to retrieve note content.

  2. noteId: The note id to retrieve.

Return Value

None

1.6.13 Update Request

Syntax

updateRequest (String requestId, HashMap fieldValues)

Description

This API is used to update a request of any type (Incident, Change Request or Service Request).

Parameters

The following are the input parameters for this API:

  1. requestId: The Request Id to be updated

  2. fieldValues: The Map of Strings to Strings. Valid keys are: customerId, itemId, statusId, classificationId, impactId, urgencyId, custom1, custom2, custom3, custom4 and custom5. (Since 6.1) typeCustom1, typeCustom2, typeCustom3, typeCustom4 and typeCustom5.

Return Value

This API returns a HashMap containing a success flag to deal with Requests that can not be processed for various reasons, along with a message to state the reason.

1.6.14 Find Incident / Change Request / Service Request

Syntax

findIncident (String itemNumber, String classificationId, HashMap fieldValues)

findChangeRequest (String itemNumber, String classificationId, HashMap fieldValues)

findServiceRequest (String itemNumber, String classificationId, HashMap fieldValues)

Description

This API is used to find an Incident, Change Request or Service Request. Simply supply the function with the parameters desired to search against and process the resultant list of requests that are returned. The ‘fieldValues’ parameter can take all the arguments that are used in the updateRequestDetail method above.

Parameters

The following are the input parameters for this API:

  1. itemNumber: Find and Incident based upon on a unique item number

  2. classificationId: Find an incident based on this classification Id.

  3. fieldValues: A haspmap of fieldValues that can be searched. Takes the same keys as updateRequestDetail.

Return Value

This API returns a HashMap containing the success flag and a message.

1.6.15 Add Note To Request

Syntax

addNoteToRequest (String requestId, String note)

addNoteToRequest (String requestId, String note, String privateNdx)

addNoteToRequest (String requestId, String note, String privateNdx, String timeMins)

Description

This API is used to add a note to a request by members of the assigned team, or the customer of the request. If the privateNdx flag is specified, the value should either be set to 1 or 0, to define the note as being private or public respectively. Time can be assigned to this note for timesheet reporting by using the associated method and adding the time in minutes.

Parameters

The following are the input parameters for this API:

  1. requestId: The requestId to add the note to.

  2. note: The note contents.

  3. priateNdx: A flag to define the note as being private (1) or public (0).

  4. timeMins: The time in minutes to add to this note for timesheet reporting and billing.

Return Value

This API returns a HashMap containing the success flag to deal with requests that can’t be processed for various reasons, along with a message to state the reason. If privateNdx is not specified, added notes will be visible to the public.

1.6.16 Close Request

Syntax

closeRequest (String requestId, String reason)

Description

This API is used to set the Request to the default closed state of the assigned Workflow and add the supplied reason as the solution (if defined), and the target Request is an Incident or Service Request.

Parameters

The following are the input parameters for this API:

  1. requestId: The request Id to be closed.

  2. reason: The reason for closing this request.

Return Value

This API returns a HashMap containing the success flag and a reason field.

1.6.17 Get Response Templates

Syntax

getResponseTemplates (String requestId)

Description

This API returns a list of valid response templates for this request.

Parameters

The following are the input parameters for this API:

  1. requestId: The request Id to retrieve the response templates for.

Return Value

This API returns the responseId as the key and the template Title as the value in the response. Use getResponseTemplateContent to retrieve the actual content of a response based on a returned ID from this call.

1.6.18 Get Response Templates Content

Syntax

getResponseTemplateContent (String responseId)

Description

This API returns the actual contents of a response template by ID.

Parameters

The following are the input parameters for this API:

  1. responseId: The response Id of the template to retrieve.

Return Value

Use getResponseTemplates to get a list of valid ID’s you can use for this call. Note that the text will be HTML formatted if the text was styled using the rich text editor.

1.6.19 Get My Filters

Syntax

getMyFilters ()

Description

This API returns a list of Filters by Id and name for the current logged in user.

Parameters

None

Return Value

This API returns a HashMap containing the filter Id as the key and filter name as the value.

1.6.20 Get My Task Count

Syntax

getMyTaskCount ()

getMyTaskCount (int filterId)

Description

This API retrieves the number of currently active and assigned tasks to the current logged in user. If a filterId is passed in then it will return the number of requests with the given filter applied.

Parameters

The following are the input parameters for this API:

  1. filterId: The unique filter Id to use to return the number of requests available with that filter.

Return Value

This API returns a HashMap containing a success flag and the number of tasks.

1.6.21 Get My Tasks

Syntax

getMyTasks (int pageSize, int pageNumber, List fields, HashMap sortMap)

getMyTasks (int filterId, int pageSize, int pageNumber, List fields, HashMap sortMap)

Description

This API retrieves a list of tasks based on the data sent to the web-service function. The returned HashMap contains a success flag and the values for the keys of the given fields.

Requests will be sorted by their ID in ascending order if no sortMap is defined. The sortMap accepts all the above fields as keys. Acceptable values include:

  1. ASC – perform an ascending sort on the field

  2. DESC - perform a descending sort on the field

Key

Description

customer

Customers full name

orgUnit

Organizational Unit display name

item

Item number

status

Status name

classification

Classification

impact

Impact name

urgency

Urgency name

priorityType

Priority name

team

Team name

type

Process type

status

status name

dateCreated

Request creation date (MM/dd/yyyy HH:mm)

dateClosed

Request closed date (MM/dd/yyyy HH:mm)

dateDue

Request due date (MM/dd/yyyy HH:mm)

lastUpdated

Date request was last updated (MM/dd/yyyy HH:mm)

subject

Request subject

description

Request description

custom1…custom5

Request custom fields

typeCustom1…typeCustom5

Item type custom fields

Parameters

The following are the input parameters for this API:

  1. filterId: The filterId to apply when returning the tasks.

  2. pageSize: The maximum number of tasks that can be returned per query

  3. pageNumber In situations where there are more tasks than can fit on a page size, this number specifies the next set of tasks to be retrieved.

  4. fields Specifies the field data whose values will be retrieved from the task.

  5. sortMap Specifies the fields on which to sort the retrieved tasks.

Return Value

This API returns a HashMap containing a success flag and the number of tasks.

1.6.22 Get Attachments

Syntax

getAttachments (String requestId)

Description

This API retrieves a list of attachments for the defined requestId as a Name/URL as a key/value pair. As long as the session is valid you can then stream the file directly to the client using the specified URL.

Parameters

The following are the input parameters for this API:

  1. requestId: The request Id for which attachments have to be got.

Return Value

None

1.6.23 Get Incident States

Syntax

getIncidentStates ()

Description

This API returns all Workflow States allowed for Incidents in a HashMap, keyed on ID and name formatted as ‘workflow – state name’.

Parameters

None

Return Value

None

1.6.24 Get Problem States

Syntax

getProblemStates ()

Description

This API returns all Workflow States allowed for Problems in a HashMap, keyed on ID and name formatted as ‘workflow – state name’.

Parameters

None

Return Value

None

1.6.25 Get Change States

Syntax

getChangeRequestStates ()

Description

This API returns all Workflow States allowed for Change Requests in a HashMap, keyed on ID and name formatted as ‘workflow – state name’.

Parameters

None

Return Value

None

1.6.26 Get Service Request States

Syntax

getServiceRequestStates ()

Description

This API returns all Workflow States allowed for Service Requests in a HashMap, keyed on ID and name formatted as ‘workflow – state name’.

Parameters

None

Return Value

None

1.6.27 Get Next States

Syntax

getNextStates (String requestId)

Description

This API returns the next available Workflow States allowed for the identified request in a HashMap, keyed on ID and name formatted as ‘state name’.

Parameters

The following are the input parameters for this API:

  1. requestId: The request Id for which attachments have to be got.

Return Value

None