REST Services

On this page, you can find public REST services of Inventory Plugin for JIRA.

Sample CURL commands for REST Services of Inventory Plugin

Below, you can find sample REST service calls via CURL


curl -D- -u user:password -X [GET|POST|PUT|DELETE] -H "Content-Type: application/json"
http://path.to.jira.instance/rest/jip-api/1.0/[attribute|form|inventory][|/id|/list|/filter].json

OR

just call REST services with another method with a request header "Authorization Basic Base64Encoded(user:password)"
e.g. :"Authorization Basic YWRtaW46YWRtaW4="

Listing all attributes


http://localhost:2990/jira/rest/jip-api/1.0/attribute/list.json

Method : GET

Show sample result
                            [
                            {
                            "attributeName": "CPU",
                            "id": 10
                            },
                            {
                            "attributeName": "Computer Name",
                            "id": 8
                            },
                            {
                            "attributeName": "Date of Purchase",
                            "id": 17
                            },
                            {
                            "attributeName": "First Name",
                            "id": 1
                            },
                            {
                            "attributeName": "Gender",
                            "id": 4,
                            "values": [
                                {
                                "id": 4,
                                "sortOrder": 0,
                                "attributeValue": "Male"
                                },
                                {
                                "id": 5,
                                "sortOrder": 0,
                                "attributeValue": "Female"
                                }
                            ]
                            },
                            {
                            "attributeName": "IP",
                            "id": 6
                            },
                            {
                            "attributeName": "JIRA User",
                            "id": 9
                            },
                            {
                            "attributeName": "Keyboard",
                            "id": 14,
                            "values": [
                                {
                                "id": 6,
                                "sortOrder": 0,
                                "attributeValue": "Standard Windows Q"
                                },
                                {
                                "id": 7,
                                "sortOrder": 1,
                                "attributeValue": "Wireless"
                                },
                                {
                                "id": 8,
                                "sortOrder": 2,
                                "attributeValue": "Multimedia"
                                }
                            ]
                            },
                            {
                            "attributeName": "Last Name",
                            "id": 2
                            },
                            {
                            "attributeName": "License Key",
                            "id": 12
                            },
                            {
                            "attributeName": "MAC Address",
                            "id": 16
                            },
                            {
                            "attributeName": "Memory",
                            "id": 11
                            },
                            {
                            "attributeName": "Model",
                            "id": 18
                            },
                            {
                            "attributeName": "Monitor",
                            "id": 13
                            },
                            {
                            "attributeName": "Mouse",
                            "id": 15,
                            "values": [
                                {
                                "id": 9,
                                "sortOrder": 0,
                                "attributeValue": "Standard Mouse"
                                },
                                {
                                "id": 10,
                                "sortOrder": 1,
                                "attributeValue": "Wireless Mouse"
                                },
                                {
                                "id": 11,
                                "sortOrder": 2,
                                "attributeValue": "Optical Mouse"
                                },
                                {
                                "id": 12,
                                "sortOrder": 3,
                                "attributeValue": "Bluetooth Mouse"
                                }
                            ]
                            },
                            {
                            "attributeName": "Organization",
                            "id": 3,
                            "values": [
                                {
                                "id": 3,
                                "sortOrder": 0,
                                "attributeValue": "Customer Care"
                                },
                                {
                                "id": 2,
                                "sortOrder": 0,
                                "attributeValue": "System Department"
                                },
                                {
                                "id": 1,
                                "sortOrder": 0,
                                "attributeValue": "Software Department"
                                }
                            ]
                            },
                            {
                            "attributeName": "Serial Number",
                            "id": 7
                            },
                            {
                            "attributeName": "Server Name",
                            "id": 5
                            },
                            {
                            "attributeName": "Storage Type",
                            "id": 19,
                            "values": [
                                {
                                "id": 13,
                                "sortOrder": 0,
                                "attributeValue": "FATA"
                                },
                                {
                                "id": 14,
                                "sortOrder": 1,
                                "attributeValue": "SATA"
                                },
                                {
                                "id": 15,
                                "sortOrder": 2,
                                "attributeValue": "SSD"
                                }
                            ]
                            }
                        ]
                        

List single attribute


http://localhost:2990/jira/rest/jip-api/1.0/attribute/[attributeId].json

Method : POST

Show sample result
                          {
                          "attributeName": "Organization",
                          "attributeType": "ListBox",
                          "id": 3,
                          "values": [
                            {
                              "id": 3,
                              "sortOrder": 0,
                              "attributeValue": "Customer Care"
                            },
                            {
                              "id": 2,
                              "sortOrder": 0,
                              "attributeValue": "System Department"
                            },
                            {
                              "id": 1,
                              "sortOrder": 0,
                              "attributeValue": "Software Department"
                            }
                          ]
                        }
                        


Possible failure messages :
                            {
                            success:
                            false,
                            message:
                            "Could not find form with id:[id]"
                            }
                        

New attribute


http://localhost:2990/jira/rest/jip-api/1.0/attribute.json

Method : POST

Show sample data
                            {
                            "attributeName": "Storage Type",
                            "attributeType": "DropdownList",
                            "values": [
                              {
                                "sortOrder": 0,
                                "attributeValue": "FATA"
                              },
                              {
                                "sortOrder": 1,
                                "attributeValue": "SATA"
                              },
                              {
                                "sortOrder": 2,
                                "attributeValue": "SSD"
                              }
                            ]
                        }
                        
OR for non-multi valued attributes

                            {
                            "attributeName": "Test Text Sample Attribute",
                            "attributeType": "Test Text"
                            }
                        


Success message :
                            {
                            "success": true,
                            "message": "Attribute[Storage Type] created successfully"
                            }
                        

Possible failure messages :
                            {
                            "success": false,
                            "message": "[attributeValue] should not be empty"
                            }
                        
                            {
                            "success": false,
                            "message": "Please define at least one attribute value for type [DropdownList]"
                            }
                        

Update attribute


http://localhost:2990/jira/rest/jip-api/1.0/attribute/[attributeId].json

Method : PUT

For multi value types (e.g. DropdownList) :
                            {
                            "attributeName": "Storage Type",
                            "attributeType": "DropdownList",
                            "values": [
                              {
                                "sortOrder": 0,
                                "attributeValue": "FATA2"
                              },
                              {
                                "sortOrder": 1,
                                "attributeValue": "SATA2"
                              },
                              {
                                "sortOrder": 2,
                                "attributeValue": "SSD2"
                              }
                            ]
                          }
                        
or for single value for the attributes that have not multiple values (e.g. Textbox)
                            {
                            "attributeName": "CPU"
                            }
                        
Possible failure messages :
                            {
                            "success": false,
                            "message": "attributeType should be one of [DropdownList,ListBox,ListBoxMultiple,Text,TextArea,RadioButtonList,CheckboxList,DatePicker,DatetimePicker,UserPicker]"
                            }
                        
                            {
                            "success": false,
                            "message": "attributeName or attributeType should not be empty"
                            }
                        
                            {
                            "success": false,
                            "message": "Could not find attribute with id:190"
                            }
                        

Delete attribute


http://localhost:2990/jira/rest/jip-api/1.0/attribute/[attributeId].json

Method : DELETE

Success messages :
                            {
                            "success": true
                            "message": "Attribute[attributeId] deleted successfully"
                            }
                        
Possible failure message :
                            {
                            "success": false
                            "message": "Attribute[attributeId] could not be found"
                            }
                        







Listing all forms


http://localhost:2990/jira/rest/jip-api/1.0/form/list.json

Method : GET

Show sample data
                          [
                          {
                            "id": 2,
                            "formName": "Servers",
                            "attributes": [
                              {
                                "id": 8,
                                "attribute": {
                                  "attributeName": "Serial Number",
                                  "attributeType": "Text",
                                  "id": 7
                                },
                                "sortOrder": 0
                              },
                              {
                                "id": 7,
                                "attribute": {
                                  "attributeName": "IP",
                                  "attributeType": "Text",
                                  "id": 6
                                },
                                "sortOrder": 0
                              },
                              {
                                "id": 6,
                                "attribute": {
                                  "attributeName": "Server Name",
                                  "attributeType": "Text",
                                  "id": 5
                                },
                                "sortOrder": 0
                              }
                            ]
                          },
                          {
                            "id": 3,
                            "formName": "Personal Computers",
                            "attributes": [
                              {
                                "id": 18,
                                "attribute": {
                                  "attributeName": "Computer Name",
                                  "attributeType": "Text",
                                  "id": 8
                                },
                                "sortOrder": 0
                              },
                              {
                                "id": 12,
                                "attribute": {
                                  "attributeName": "First Name",
                                  "attributeType": "Text",
                                  "id": 1
                                },
                                "sortOrder": 1
                              },
                              {
                                "id": 13,
                                "attribute": {
                                  "attributeName": "Last Name",
                                  "attributeType": "Text",
                                  "id": 2
                                },
                                "sortOrder": 2
                              },
                              {
                                "id": 16,
                                "attribute": {
                                  "attributeName": "Serial Number",
                                  "attributeType": "Text",
                                  "id": 7
                                },
                                "sortOrder": 3
                              },
                              {
                                "id": 20,
                                "attribute": {
                                  "attributeName": "License Key",
                                  "attributeType": "Text",
                                  "id": 12
                                },
                                "sortOrder": 4
                              },
                              {
                                "id": 17,
                                "attribute": {
                                  "attributeName": "IP",
                                  "attributeType": "Text",
                                  "id": 6
                                },
                                "sortOrder": 5
                              },
                              {
                                "id": 15,
                                "attribute": {
                                  "attributeName": "Organization",
                                  "attributeType": "ListBox",
                                  "id": 3,
                                  "values": [
                                    {
                                      "id": 3,
                                      "sortOrder": 0,
                                      "attributeValue": "Customer Care"
                                    },
                                    {
                                      "id": 2,
                                      "sortOrder": 0,
                                      "attributeValue": "System Department"
                                    },
                                    {
                                      "id": 1,
                                      "sortOrder": 0,
                                      "attributeValue": "Software Department"
                                    }
                                  ]
                                },
                                "sortOrder": 6
                              },
                              {
                                "id": 19,
                                "attribute": {
                                  "attributeName": "JIRA User",
                                  "attributeType": "UserPicker",
                                  "id": 9
                                },
                                "sortOrder": 7
                              },
                              {
                                "id": 21,
                                "attribute": {
                                  "attributeName": "CPU",
                                  "attributeType": "Text",
                                  "id": 10
                                },
                                "sortOrder": 8
                              },
                              {
                                "id": 22,
                                "attribute": {
                                  "attributeName": "Memory",
                                  "attributeType": "Text",
                                  "id": 11
                                },
                                "sortOrder": 9
                              },
                              {
                                "id": 23,
                                "attribute": {
                                  "attributeName": "Keyboard",
                                  "attributeType": "ListBox",
                                  "id": 14,
                                  "values": [
                                    {
                                      "id": 6,
                                      "sortOrder": 0,
                                      "attributeValue": "Standard Windows Q"
                                    },
                                    {
                                      "id": 7,
                                      "sortOrder": 1,
                                      "attributeValue": "Wireless"
                                    },
                                    {
                                      "id": 8,
                                      "sortOrder": 2,
                                      "attributeValue": "Multimedia"
                                    }
                                  ]
                                },
                                "sortOrder": 10
                              },
                              {
                                "id": 24,
                                "attribute": {
                                  "attributeName": "Mouse",
                                  "attributeType": "ListBox",
                                  "id": 15,
                                  "values": [
                                    {
                                      "id": 9,
                                      "sortOrder": 0,
                                      "attributeValue": "Standard Mouse"
                                    },
                                    {
                                      "id": 10,
                                      "sortOrder": 1,
                                      "attributeValue": "Wireless Mouse"
                                    },
                                    {
                                      "id": 11,
                                      "sortOrder": 2,
                                      "attributeValue": "Optical Mouse"
                                    },
                                    {
                                      "id": 12,
                                      "sortOrder": 3,
                                      "attributeValue": "Bluetooth Mouse"
                                    }
                                  ]
                                },
                                "sortOrder": 11
                              },
                              {
                                "id": 25,
                                "attribute": {
                                  "attributeName": "Monitor",
                                  "attributeType": "Text",
                                  "id": 13
                                },
                                "sortOrder": 12
                              }
                            ]
                          }
                        ]
                        

List single form


http://localhost:2990/jira/rest/jip-api/1.0/form/[formId].json

Method : GET

Show sample data
                            {
                            "id": 1,
                            "name": "Alpha Tomcat Server",
                            "formId": 2,
                            "sortOrder": 0,
                            "attributes": [
                            {
                                "id": 1,
                                "attribute": {
                                "attributeName": "Server Name",
                                "attributeType": "Text",
                                "id": 5
                                },
                                "attributeValue": "cyrus"
                            },
                            {
                                "id": 2,
                                "attribute": {
                                "attributeName": "IP",
                                "attributeType": "Text",
                                "id": 6
                                },
                                "attributeValue": "10.10.13.21"
                            },
                            {
                                "id": 3,
                                "attribute": {
                                "attributeName": "Serial Number",
                                "attributeType": "Text",
                                "id": 7
                                },
                                "attributeValue": "1254-4432-3455-6642"
                            }
                            ]
                        }
                        


Possible failure messages :
                            {
                            "success":false,
                            "message":"Could not find form with id:[formId]"
                            }
                        

New form


http://localhost:2990/jira/rest/jip-api/1.0/form.json

Method : POST

Show sample data
                                {
                                  "formName": "My new form name",
                                  "attributes": [
                                    {"attributeName": "Computer Name"},
                                    {"attributeName": "First Name"},
                                    {"attributeName": "Last Name"},
                                    {"attributeName": "Serial Number"},
                                    {"attributeName": "License Key"},
                                    {"attributeName": "IP"},
                                    {"attributeName": "Organization"},
                                    {"attributeName": "JIRA User"},
                                    {"attributeName": "CPU"},
                                    {"attributeName": "Memory"},
                                    {"attributeName": "Keyboard"},
                                    {"attributeName": "Mouse"},
                                    {"attributeName": "Monitor"}
                                  ]
                                }
                            


Possible failure messages :
                            {
                            "success": false
                            "message": "[formName] should not be empty"
                            }
                        
                            {
                            "success": false
                            "message": "You may define at least one form attribute"
                            }
                        
                            {
                            "success": false
                            "message": "Could not find form with id:formId"
                            }
                        

Update form


http://localhost:2990/jira/rest/jip-api/1.0/form/[formId].json

Method : PUT

                            {
                            "formName": "My new form name"
                            }
                        

Success message :
                            {
                            "success": true,
                            "message": "Form[formId] updated successfully"
                            }
                        
Failure messages :
                            {
                            "success": false
                            "message": "[formName] should not be empty"
                            }
                        
                            {
                            "success": false
                            "message": "Could not find form with id:[formId]"
                            }
                        

Delete form


http://localhost:2990/jira/rest/jip-api/1.0/form/[formId].json

Method : DELETE

Success messages :
                            {
                            "success": true,
                            "message": "Form[id] deleted successfully"
                            }
                        
Failure message :
                            {
                            "success": false,
                            "message": "Form[formId] could not be found"
                            }
                        







Listing all inventories


http://localhost:2990/jira/rest/jip-api/1.0/inventory/list.json

Method : GET

Show sample result
                            [
                              {
                                "id": 12,
                                "name": "Alpha Database Server",
                                "formId": 2,
                                "sortOrder": 0,
                                "attributes": [
                                  {
                                    "id": 120,
                                    "attribute": {
                                      "attributeName": "Serial Number",
                                      "attributeType": "Text",
                                      "id": 7
                                    },
                                    "attributeValue": "3243-34343-434-2344"
                                  },
                                  {
                                    "id": 121,
                                    "attribute": {
                                      "attributeName": "IP",
                                      "attributeType": "Text",
                                      "id": 6
                                    },
                                    "attributeValue": "10.10.13.24"
                                  },
                                  {
                                    "id": 122,
                                    "attribute": {
                                      "attributeName": "Server Name",
                                      "attributeType": "Text",
                                      "id": 5
                                    },
                                    "attributeValue": "gollum"
                                  }
                                ]
                              },
                              {
                              ...
                              }
                            ]
                            

List single inventory


http://localhost:2990/jira/rest/jip-api/1.0/inventory/[inventoryId].json

Method : GET

Show sample result
                            {
                          "id": 1,
                          "name": "Alpha Tomcat Server",
                          "formId": 2,
                          "sortOrder": 0,
                          "attributes": [
                            {
                              "id": 1,
                              "attribute": {
                                "attributeName": "Server Name",
                                "attributeType": "Text",
                                "id": 5
                              },
                              "attributeValue": "cyrus"
                            },
                            {
                              "id": 2,
                              "attribute": {
                                "attributeName": "IP",
                                "attributeType": "Text",
                                "id": 6
                              },
                              "attributeValue": "10.10.13.21"
                            },
                            {
                              "id": 3,
                              "attribute": {
                                "attributeName": "Serial Number",
                                "attributeType": "Text",
                                "id": 7
                              },
                              "attributeValue": "1254-4432-3455-6642"
                            }
                          ]
                        }
                        


Failure messages :
                            {
                            "success":
                            false,
                            "message":
                            "Could not find inventory with id:[id]
                            }
                        

Filtering inventory


http://localhost:2990/jira/rest/jip-api/1.0/inventory/filter.json

Method : POST

Filtering by only attribute :
                            {
                            "attributeId": 2,
                            "attributeValue": "Value to filter"
                            }
                        

Filtering by only form :
                            {
                            "formId": 3
                            }
                        

Filtering by inventory name :
                            {
                            "name": "Kevin's computer"
                            }
                        

Filtering by form and attribute :
                            {
                            "formId": 3,
                            "attributeId": 15,
                            "attributeValue": "Optical Mouse"
                            }
                        

Possible failure messages :
                            {
                            "success": false,
                            "message": "[formId] or [attributeId] should be specified"
                            }
                        

New inventory


http://localhost:2990/jira/rest/jip-api/1.0/inventory.json

Method : POST

Show sample data
                              {
                              "formId": 7,
                              "name": "Test Inventory",
                              "attributes": [
                                    {
                                      "attributeId": 8,
                                      "attributeValue": "My computer name"
                                    },
                                    {
                                      "attributeId": 19,
                                      "attributeValue": "FATA"
                                    },
                                    {
                                      "attributeId": 7,
                                      "attributeValue": "My Serial Number"
                                    }
                                ]
                                }
                            


Possible failure messages :
                            {
                            success: false,
                            message: "[name] should not be empty"
                            }
                        
                            {
                            success: false,
                            message: "[formId] should not be empty"
                            }
                        
                            {
                            success: false,
                            message: "Form[formId] could not be found"
                            }
                        
                            {
                            success: false,
                            message: "Form[formName] does not have an attribute with id:[attributeId]"
                            }
                        
                            {
                            "success": false,
                            "message": "Attribute[attributeName] does not have a defined value[attributeValue]"
                            }
                        
                            {
                            "success": false,
                            "message": "You may define at least one inventory attribute"
                            }
                        

Update inventory


http://localhost:2990/jira/rest/jip-api/1.0/inventory/[inventoryId].json

Method : PUT

Show sample data
                                {
                                "id": 22,
                                "formId": 7,
                                "name": "Updated Storage",
                                "attributes": [
                                    {
                                        "attributeId": 19,
                                        "attributeValue": "SATA"
                                    },
                                    {
                                        "attributeId": 8,
                                        "attributeValue": "Updated computer name"
                                    },
                                    {
                                        "attributeId": 7,
                                        "attributeValue": "Updated Serial Number"
                                    }
                                ]
                                }
                            


Success message :
                            {
                            "success": true,
                            "message": "Inventory[id] updated successfully"
                            }
                        
Possible failure messages :
                            {
                            "success": false,
                            "message": "Could not find inventory with id:[id]"
                            }
                        
                            {
                            "success": false,
                            "message": "Form[formName] does not have an attribute with id:[attributeId]"
                            }
                        

Delete inventory


http://localhost:2990/jira/rest/jip-api/1.0/inventory/[inventoryId].json

Method : DELETE

Success messages :
                            {
                            "success": false
                            "message": "Inventory[inventoryId] deleted successfully"
                            }
                        
Possible failure message :
                            {
                            "success": false
                            "message": "Inventory[id] could not be found"
                            }