1.5 Item API

1.5.1 Create Item

Syntax

createItem (String itemTypeId, HashMap fieldValues)

createItem (String itemTypeId, String ownerCustomerId, HashMap fieldValues)

Description

This API enters a new Configuration Item (CI). Enter the Item Type ID, a Customer ID, and a set of Item Type field values.

The fieldValues HashMap is a Map of Strings to Strings. The keys represent Service desk data fields called custom1 through to custom20. These map to the category field definitions within the CMS. Other keys include itemNumber which allow the item to be created with a given item number (provided the Edit Item Numbers admin privilege is enabled).

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item number.

Return Value

This API returns a HashMap containing the Configuration Item ID and a success or failure message.

1.5.2 Delete Items

Syntax

deleteItem (String itemNumber)

Description

This API flags an Item as deleted so that it is no longer available for new requests.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item number.

Return Value

None

1.5.3 Undelete Items

Syntax

undeleteItem (String itemNumber)

Description

This API re-instates a previously deleted Item so that it is available for all future requests.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item number.

Return Value

None

1.5.4 Update Items

Syntax

updateItem (String itemNumber, HashMap fieldValues)

Description

This API updates the Item with new field values from the supplied hash map.

The fieldValues HashMap is a map of Strings to Strings. The keys represent Service desk data fields called custom1 through to custom20. Other keys include itemstatus and itemNumber for changes to the item status and item number fields respectively. These map to the Category field definitions within the CMDB.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item number.

  2. fieldValues: A HashMap of field values for this Item.

Return Value

None

1.5.5 Get Items

Syntax

getItems ()getItems (String customerId)

getItems (String customerId, String pageNdx)

getItems (String customerId, String itemNumber, HashMap fieldValues)

Description

This API returns a list of the item numbers that are either global or owned by the logged in Customer (or the Customer specified if using the customerId function). The response is in the form of a HashMap that uses the list of Item Numbers as field names. Each field has as its value a String containing the name of the Item Type that the Item represents.

In the event that no Items are found for the logged in Customer, only the ‘message’ field will be present and will contain a text message explaining that no Items were found.

Parameters

The following are the input parameters for this API:

  1. customerId: The unique Customer Id.

  2. itemNumber: The unique Item Number to retrieve. If this value is set, then fieldValues will be ignored.

  3. fieldValues: A hash map of field names and values used to search for an appropriate CI. This will be ignored if the Item Number has already been set.

Return Value

The return value of this API is a HashMap containing a list of string values detailing the Item Number(s) and description(s). This returns the first 100 items. Use getItems(customerId, pageNdx) to page through larger result sets.

1.5.6 Get All Items

Syntax

getAllItems (String pageNdx)

Description

This API returns a list of Item Numbers for all the Items in the system. A page index is required to specify the page required. Each page contains 100 entries, ordered by Item Number.

Parameters

The following are the input parameters for this API:

  1. pageNdx: The page index returns 100 entries ordered by Item Number.

Return Value

The return value of this API is a HashMap that uses the list of Item Numbers as field names. Each field has as its value a String containing the name of the Item Type that the Item represents.

1.5.7 Get Specific Item

Syntax

getSpecificItem (String itemNumber)

Description

This API returns the Item Type of the specified item number. This API provide a quick means to verify that a certain Item Number is defined in the system, without requiring heavy data exchange of Item attributes.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item number.

Return Value

None

1.5.8 Customer Items

Syntax

customerItems (String customerId, String pagesize, String pagenumber, String sortNdx)

customerItems (String pagesize, String pagenumber, String sortNdx)

Description

This API returns a list of the item numbers that are either owned by the customer or are global.

The response is in the form of a HashMap that uses the list of item numbers as field names. Each field has as its value a String containing the name of the Item Type that the Item represents.In the argument (customerId) enter the ID of a Customer, this is assigned to the Customer when it is created via the createCustomer function.

Parameters

The following are the input parameters for this API:

  1. customerId: A unique customer ID.

  2. pagesize: The maximum number of items that can be returned per query.

  3. pagenumber: In situations where there are more items than can fit on a pagesize, this number specifies the next set of items to be retrieved.

  4. sortNdx: The index of the column to sort on. The possible values for the parameter are:

    1. 1: Item Number

    2. 2: Item Category

    3. 3: Item Type

    4. 7: Item Status

    5. 8: Purchase Date

    6. 9: Incident Team

    7. In Service Manager, you can also specify:

      1. 10: Problem Team

      2. 11: Change Team

      3. 12: Service Request Team

Return Value

This API returns a HashMap containing a list of string values detailing the Item Number(s) and description(s), being the corresponding Item Types.

In the event that no Items are found for the Customer, only the message field will be present and will contain a text message explaining that no Items were found.

1.5.9 Org Unit Items

Syntax

orgUnitItems (String orgUnitId, String pagesize, String pagenumber, String sortNdx)

orgUnitItems (String pagesize, String pagenumber, String sortNdx)

Description

This API is used to search for Items owned by the logged in User’s Org Unit or the Org Unit ID specified.

Parameters

The following are the input parameters for this API:

  1. orgUnitId: A unique Org Unit ID.

  2. pagesize: The maximum number of items that can be returned per query. The page size must be between 10 and 100.

  3. pagenumber: In situations where there are more items than can fit on a pagesize, this number specifies the next set of items to be retrieved. The page number must be at least 0.

  4. sortNdx: The index of the column to sort on. The possible values for the parameter are:

    1. 1: Item Number

    2. 2: Item Category

    3. 3: Item Type

    4. 7: Item Status

    5. 8: Purchase Date

    6. 9: Incident Team

    7. In Service Manager, you can also specify:

      1. 11: Problem Team

      2. 12: Change Team

Return Value

This API returns a HashMap containing of HashMaps. The keys of the first map are the Item Numbers. Each Item Number has its own HashMap representing the values that represent Item attributes as name-value pairs.

1.5.10 Add Item Owner

Syntax

addItemOwner (String itemNumber, String username)

Description

This API adds a new Customer from an Item with the specified item number.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item number.

  2. username The user name of the user who wants to add the item owner.

Return Value

None

1.5.11 Remove Item Owner

Syntax

removeItemOwner (String itemNumber, String username)

Description

This API removes an existing Customer from an Item with the specified item number.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item number.

  2. username The user name of the user who wants to remove the item owner.

Return Value

None

1.5.12 Get Item Owner

Syntax

getItemOwners (String itemNumber)

Description

This API returns a list of all the owners of an item with the specified item number.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item number.

Return Value

This API returns a HashMap which contains another HashMap for each entry. The key of the first map is the Customer ID of the returned user, the HashMap for that entry contains four string fields representing the Customer’s Last Name, Org Unit, Primary E-mail Address and First Name. Global items will return a success response message.

1.5.13 Get Fields For Item

Syntax

getFieldsForItem (String itemNumber)

Description

This API returns a list of all Configuration Item fields for the specified item number.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item number.

Return Value

This API returns two HashMaps, the first containing a list of CI field Ids, and the second containing the field values include the field name, whether the field is required, the data type, the field’s default value (if specified), and the field options if any are available.

1.5.14 Get Fields For Item Type

Syntax

getFieldsForItemType (String itemTypeId)

Description

This API returns a list of all Configuration Item fields for the specified Item Type ID.

Parameters

The following are the input parameters for this API:

  1. itemTypeId: The unique Item type id.

Return Value

This API returns two HashMaps, the first containing a list of CI field Ids, and the second containing the field values include the field name, whether the field is required, the data type, the field’s default value (if specified), and the field options if any are available.

1.5.15 Get Fields For Related Item

Syntax

getFieldsForRelatedItem (String itemNumber)

Description

This API returns information on all relationships for the specified item number.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item number.

Return Value

This API returns a HashMap containing of HashMaps, the outer keyed on the Item Numbers – the HashMap for each Item contains data such as the related Item Number, Criticality, Type and how it’s related to the Item with the given itemNumber.

1.5.16 Create Manufacturer

Syntax

createManufacturer (String name)

Description

This API creates a Manufacturer with the given name.

Parameters

The following are the input parameters for this API:

  1. name: The unique name of the Manufacturer to be created.

Return Value

None

1.5.17 Add Item Note

Syntax

addItemNote(String itemNumber, String note)

Description

This API adds a new note to an item with the give itemNumber.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item Number of the Item to be retrieved.

  2. note: The note contents

Return Value

None

1.5.18 Update Item Description

Syntax

updateItemDescription(String itemNumber, String desc)

Description

This API updates the description of an item with the given itemNumber. If the item does not have any description then it will add description to the item.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item Number of the Item to be retrieved.

  2. desc: The description of the contents

Return Value

None

1.5.19 Update Item Cost

Syntax

updateItemCost(String itemNumber, String cost)

Description

This API updates the cost of an item with the given itemNumber. If the item does not have any cost then it will add cost to the item.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique Item Number of the Item to be retrieved.

  2. cost: The cost of the item to be updated

Return Value

None

1.5.20 Get Item Categories

Syntax

getItemCategories ()

Description

This API returns a list of all the Configuration Item (CI) Categories defined in the system.

Parameters

None

Return Value

This API returns a HashMap containing a list of string values including the Category ID and the corresponding string value.

1.5.21 Get Item Type For Category

Syntax

getItemTypesForCategory (String categoryId)

Description

This API returns a list of all the Item Types that exist in the system for the specified Category ID.

Parameters

The following are the input parameters for this API:

  1. categoryId: The unique category Id for which item type has to be retrieved.

Return Value

This API returns a HashMap containing a list of string values including the Item Type ID and the corresponding string value.

1.5.22 Create Item Type

Syntax

createItemType (String itemTypeName, String incidentTeamID, String problemTeamID, String changeTeamID, String requestTeamID, String manufacturerName, String categoryID)

Description

This API creates an ItemType (product) based on the name, the provided support teams, the manufacturer (which will be created if it doesn’t exist) and the Category ID which is returned by getItemCategories().

Parameters

The following are the input parameters for this API:

  1. itemTypeName: A name for the Item Type

  2. incidentTeamID: The default Incident Team Id for this Item Type

  3. problemTeamID: The default Problem Team Id for this Item Type

  4. changeTeamID: The default Change Team Id for this Item Type

  5. requestTeamID: The default Service Request Team Id for this Item Type

  6. manufacturerName:The name of Manufacturer (created if not available)

  7. categoryId: The default categoryId to associate the new Item Type

Return Value

None

1.5.23 Get Item Type

Syntax

getItemType (String itemTypeId)

Description

This API returns item type details of the specified item type id. This API exists as a quick means to determine what category an item type is defined as.

Parameters

The following are the input parameters for this API:

  1. itemTypeId: The unique item type Id for which details have to be retrieved.

Return Value

This API returns value is a HashMap containing the item type name and the category name.

1.5.24 Get Item Type

Syntax

getItemType (String itemTypeId)

Description

This API returns item type details of the specified item type id. This API exists as a quick means to determine what category an item type is defined as.

Parameters

The following are the input parameters for this API:

  1. itemTypeId: The unique item type Id for which details have to be retrieved.

Return Value

This API returns value is a HashMap containing the item type name and the category name.

1.5.25 Get Item Relationship Type

Syntax

getItemRelationshipTypes()

Description

This API returns all the relationships, along with their class and a marker to denote inherited ownership.

Parameters

None

Return Value

The return value format is *RelationName [RelationClass] (the asterix will not be present if ownership is not inherited). The Key to the HashMap is the relationTypeId, which needs to be passed into the createItemRelationship() function (below).

1.5.26 Create Item Relationships

Syntax

createItemRelationship(String fromItemId, String toItemId, String relationTypeId)

Description

This API is used to create a new relationship if it does not exist.

Parameters

The following are the input parameters for this API:

  1. fromItemId: The unique Id of the source Item to create a relationship with parent

  2. toItemId: The unique Id of the child Item to create the relationship

  3. relationTypeId: The Id returned by getItemRelationshipTypes() function signifying the type of relationship to create

Return Value

None

1.5.27 Delete Item Relationships

Syntax

deleteItemRelationship (String fromItemId, String toItemId, String relationTypeId)

Description

This API is used to delete the relationship.

Parameters

The following are the input parameters for this API:

  1. fromItemId: The unique Id of the source Item

  2. toItemId: The unique Id of the child Item

  3. relationTypeId: The Id returned by getItemRelationshipTypes() function signifying the type of relationship

Return Value

None

1.5.28 Get Item Relationships

Syntax

getItemRelationships (String itemNumber)

Description

This API returns all the related items for the given itemNumber.

Parameters

The following are the input parameters for this API:

  1. itemNumber: The unique item number to identify the relationships for.

Return Value

This API returns a HashMap containing the Item Number of the related Item and a Relationship ID.

1.5.29 Get Incident Teams

Syntax

getIncidentTeams()

Description

This API returns the Teams for the Incident process (1000).

Parameters

None

Return Value

None

1.5.30 Get Problem Teams

Syntax

getProblemTeams()

Description

This API returns the Teams for the Problem process (2000).

Parameters

None

Return Value

None

1.5.31 Get Change Teams

Syntax

getChangeTeams()

Description

This API returns the Teams for the Change process (3000).

Parameters

None

Return Value

None

1.5.32 Get Service Request Teams

Syntax

getServiceRequestTeams()

Description

This API returns the Teams for the Service Request process (7000).

Parameters

None

Return Value

None