API Definition
Endpoint: JIRA_BASE_URL/rest/jip-api/1.0/index/query.json
Method: POST
Request Headers:
- Content-Type: application/json
- Authorization: Basic hash of user name and password. Example: Basic YWRtaW46YWRtaW4=
Post parameters
Parameter | Type | Example | Description |
---|---|---|---|
searchType | String | basic | Fixed value |
listType | String | detail | Fixed value |
genericKeyword | String | For advanced manual Lucene Query. Leave it null to use queryIndexSearchParams | |
queryIndexSearchParams | List of QueryIndexSearchParam | List of search criteria | |
pageNumber | Integer | 1 | Page number of the results. Results will return as paged. |
pageSize | Integer | 15 | Size of page |
sortDirection | String | asc / desc | asc or desc |
sortField | String | asset.name | Field to sort. Use system fields or attribute names. |
sortType | String | STRING | Use one of search field types. |
QueryIndexSearchParam
Parameter | Type | Example | Description |
---|---|---|---|
field | String | External System Id | Field to search. Attribute name or System Fields are valid. |
keyword | String | AB001 | Wildcard search is supported. i.e Tom* or Tom? |
keywords | List of String | ["AB", "XDVl", "DRR"] | Use this field for LIST, ALL_ASSETS_REF and ASSETS_REF_BY_FORM field types searches. |
minNum | Float | 1 or 10.5 | Use this field for LONG and DOUBLE field types. For exact search set range to false and use minNum field. |
maxNum | Float | 1 or 10.5 | Use this field for LONG and DOUBLE field types. For exact search set range to false and use minNum field and set maxNum to null |
minDate | String | 2019-05-29T11:49 or 2019-05-29 | Use this field for DATE and DATE_TIME field types. Use ISO time format. For exact search set range to false and use minDate field. |
maxDate | String | 2019-05-29T11:49 or 2019-05-29 | Use this field for DATE and DATE_TIME field types. Use ISO time format. For exact search set range to false and use minDate field and and set maxDate to null |
fieldType | String | STRING | One of Search Field Types |
range | boolean | true / false | For date and numeric RANGE searches. Set "false" for exact search. |
Search Field Types
Field Type (use capital case) | |
---|---|
LIST | List type of attributes |
STRING | Text field |
DATE | Date field without time |
DATE_TIME | Date field with time |
LONG | Numeric long value, i.e. 1001 |
DOUBLE | Numeric Double/Floeat value, i.e. 100.12 |
ALL_ASSETS_REF | Asset reference attribute type |
ASSETS_REF_BY_FORM | Asset reference filtered with asset type attribute type |
System Fields
These fields are available to search and sort.
System Field Name | Field Type | Description |
---|---|---|
asset.content | STRING | Any field. Search for any field including system fields and attributes. |
scheme.id | LONG | Asset type scheme id |
scheme.name | LIST | Asset type scheme name |
form.id | LONG | Asset type ID (formerly FORM) |
form.name | LIST | Asset type name (formerly FORM) |
asset.id | LONG | Asset ID |
asset.name | STRING | Asset name |
asset.attachment | STRING | Attachment file name (not content of the file) |
asset.creator | STRING | User name of the user how created asset. |
asset.created | DATE_TIME | Create date time of asset |
Examples:
Search for one String field
Request
{ "searchType": "basic", "listType": "detail", "genericKeyword": null, "queryIndexSearchParams": [ { "field": "External System Id", "keyword": "1012", "keywords": [], "fieldType": "STRING", "range": true } ], "pageNumber": 1, "pageSize": 15, "sortDirection": "asc", "sortField": "asset.name", "sortType": "STRING", "respTime": 1558685025363 }
Response
{ "queryIndexParam": { "searchType": "basic", "listType": "detail", "genericKeyword": null, "queryIndexSearchParams": [ { "field": "External System Id", "fieldLabel": null, "keyword": "1012", "keywords": [], "fieldType": "STRING", "minNum": null, "maxNum": null, "minDate": null, "maxDate": null, "range": true } ], "pageNumber": 1, "pageSize": 15, "sortDirection": "asc", "sortField": "asset.name", "sortType": "STRING", "respTime": 1558685031755 }, "recordIds": [ null ], "queryPagingInfo": { "pageRecordSize": 1, "totalRecords": 1, "totalPages": 1, "pageNumber": 1, "pageSize": 15, "hasNext": false }, "assets": [ { "id": 21, "name": "Printer002", "sortOrder": 0, "objectSchemaId": 1, "objectSchemaName": "Default Asset Scheme", "formId": 6, "formName": "Printers", "created": null, "createdFormatted": null, "creator": null, "attachments": "[ ]", "inventoryItems": [ { "value": "1012", "attributeName": "External System Id", "attributeType": "Text", "inventoryRefs": [], "multiListValues": [], "attributeId": 84, "id": 1207, "formAttributeId": 397, "displayValue": "1012", "textValues": "1012", "isoDateValue": null }, { "value": "12685-3434-4522-1335", "attributeName": "Serial Number", "attributeType": "Text", "inventoryRefs": [], "multiListValues": [], "attributeId": 7, "id": 153, "formAttributeId": 33, "displayValue": "12685-3434-4522-1335", "textValues": "12685-3434-4522-1335", "isoDateValue": null }, { "value": "HP", "attributeName": "Vendor", "attributeType": "DropdownList", "inventoryRefs": [], "multiListValues": [], "attributeId": 61, "id": 1209, "formAttributeId": 398, "displayValue": "HP", "textValues": "HP", "isoDateValue": null }, { "value": "HP 4665", "attributeName": "Model", "attributeType": "Text", "inventoryRefs": [], "multiListValues": [], "attributeId": 18, "id": 155, "formAttributeId": 35, "displayValue": "HP 4665", "textValues": "HP 4665", "isoDateValue": null } ], "customfieldId": "customfield_10100", "optionId": 10303, "inventoryItemListSize": 4 } ] }
Search for Asset Type Scheme, Asset Type, Asset Name, Asset ID
Request
{ "searchType": "basic", "listType": "detail", "genericKeyword": null, "queryIndexSearchParams": [ { "field": "asset.id", "keyword": "", "keywords": [], "fieldType": "LONG", "minNum": 1, "maxNum": 200, "minDate": null, "maxDate": null, "range": true }, { "field": "asset.name", "keyword": "tom*", "keywords": null, "fieldType": "STRING", "minNum": null, "maxNum": null, "minDate": null, "maxDate": null, "range": false }, { "field": "form.name", "keyword": null, "keywords": [ "Servers" ], "fieldType": "LIST", "minNum": null, "maxNum": null, "minDate": null, "maxDate": null, "range": false }, { "field": "scheme.name", "keywords": [ "Default Asset Scheme" ], "fieldType": "LIST" } ], "pageNumber": 1, "pageSize": 15, "sortDirection": "asc", "sortField": "asset.name", "sortType": "STRING", "respTime": 1558688161063 }
Reponse
{ "queryIndexParam" : { "searchType" : "basic", "listType" : "detail", "genericKeyword" : null, "queryIndexSearchParams" : [ { "field" : "asset.id", "fieldLabel" : null, "keyword" : "", "keywords" : [ ], "fieldType" : "LONG", "minNum" : 1.0, "maxNum" : 200.0, "minDate" : null, "maxDate" : null, "range" : true }, { "field" : "asset.name", "fieldLabel" : null, "keyword" : "tom*", "keywords" : null, "fieldType" : "STRING", "minNum" : null, "maxNum" : null, "minDate" : null, "maxDate" : null, "range" : false }, { "field" : "form.name", "fieldLabel" : null, "keyword" : null, "keywords" : [ "Servers" ], "fieldType" : "LIST", "minNum" : null, "maxNum" : null, "minDate" : null, "maxDate" : null, "range" : false }, { "field" : "scheme.name", "fieldLabel" : null, "keyword" : null, "keywords" : [ "Default Asset Scheme" ], "fieldType" : "LIST", "minNum" : null, "maxNum" : null, "minDate" : null, "maxDate" : null, "range" : false } ], "pageNumber" : 1, "pageSize" : 15, "sortDirection" : "asc", "sortField" : "asset.name", "sortType" : "STRING", "respTime" : 1558688165409 }, "recordIds" : [ null, null, null ], "queryPagingInfo" : { "pageRecordSize" : 3, "totalRecords" : 3, "totalPages" : 1, "pageNumber" : 1, "pageSize" : 15, "hasNext" : false }, "assets" : [{ "id" : 1, "name" : "Alpha Tomcat Server", "sortOrder" : 0, "objectSchemaId" : 1, "objectSchemaName" : "Default Asset Scheme", "formId" : 2, "formName" : "Servers", "created" : null, "createdFormatted" : null, "creator" : null, "attachments" : "[ {\n \"originalFileName\" : \"ombMnU6umGQ.jpg\",\n \"serverFileName\" : \"13307_43813_1556782191293.jpg\",\n \"fileSize\" : \"71 KB\",\n \"created\" : \"02/May/19 10:29 AM\",\n \"creator\" : \"admin\"\n} ]", "inventoryItems" : [ { "value" : "cyrus", "attributeName" : "Server Name", "attributeType" : "Text", "inventoryRefs" : [ ], "multiListValues" : [ ], "attributeId" : 5, "id" : 1, "formAttributeId" : 6, "displayValue" : "cyrus", "textValues" : "cyrus", "isoDateValue" : null }, { "value" : "1254-4432-3455-6642", "attributeName" : "Serial Number", "attributeType" : "Text", "inventoryRefs" : [ ], "multiListValues" : [ ], "attributeId" : 7, "id" : 3, "formAttributeId" : 8, "displayValue" : "1254-4432-3455-6642", "textValues" : "1254-4432-3455-6642", "isoDateValue" : null }, { "value" : "10.10.13.21", "attributeName" : "IP", "attributeType" : "Text", "inventoryRefs" : [ ], "multiListValues" : [ ], "attributeId" : 6, "id" : 2, "formAttributeId" : 7, "displayValue" : "10.10.13.21", "textValues" : "10.10.13.21", "isoDateValue" : null } ], "customfieldId" : "customfield_10100", "optionId" : 10111, "inventoryItemListSize" : 3 },{ "id" : 2, "name" : "Beta Tomcat Server", "sortOrder" : 0, "objectSchemaId" : 1, "objectSchemaName" : "Default Asset Scheme", "formId" : 2, "formName" : "Servers", "created" : null, "createdFormatted" : null, "creator" : null, "attachments" : null, "inventoryItems" : [ { "value" : "zeus", "attributeName" : "Server Name", "attributeType" : "Text", "inventoryRefs" : [ ], "multiListValues" : [ ], "attributeId" : 5, "id" : 4, "formAttributeId" : 6, "displayValue" : "zeus", "textValues" : "zeus", "isoDateValue" : null }, { "value" : "2344-4321-5354-5413", "attributeName" : "Serial Number", "attributeType" : "Text", "inventoryRefs" : [ ], "multiListValues" : [ ], "attributeId" : 7, "id" : 6, "formAttributeId" : 8, "displayValue" : "2344-4321-5354-5413", "textValues" : "2344-4321-5354-5413", "isoDateValue" : null }, { "value" : "10.10.13.22", "attributeName" : "IP", "attributeType" : "Text", "inventoryRefs" : [ ], "multiListValues" : [ ], "attributeId" : 6, "id" : 5, "formAttributeId" : 7, "displayValue" : "10.10.13.22", "textValues" : "10.10.13.22", "isoDateValue" : null } ], "customfieldId" : "customfield_10100", "optionId" : 10112, "inventoryItemListSize" : 3 },{ "id" : 3, "name" : "Prod Tomcat Server", "sortOrder" : 0, "objectSchemaId" : 1, "objectSchemaName" : "Default Asset Scheme", "formId" : 2, "formName" : "Servers", "created" : null, "createdFormatted" : null, "creator" : null, "attachments" : null, "inventoryItems" : [ { "value" : "apollon", "attributeName" : "Server Name", "attributeType" : "Text", "inventoryRefs" : [ ], "multiListValues" : [ ], "attributeId" : 5, "id" : 7, "formAttributeId" : 6, "displayValue" : "apollon", "textValues" : "apollon", "isoDateValue" : null }, { "value" : "9989-2838-3434-8787", "attributeName" : "Serial Number", "attributeType" : "Text", "inventoryRefs" : [ ], "multiListValues" : [ ], "attributeId" : 7, "id" : 9, "formAttributeId" : 8, "displayValue" : "9989-2838-3434-8787", "textValues" : "9989-2838-3434-8787", "isoDateValue" : null }, { "value" : "10.10.13.23", "attributeName" : "IP", "attributeType" : "Text", "inventoryRefs" : [ ], "multiListValues" : [ ], "attributeId" : 6, "id" : 8, "formAttributeId" : 7, "displayValue" : "10.10.13.23", "textValues" : "10.10.13.23", "isoDateValue" : null } ], "customfieldId" : "customfield_10100", "optionId" : 10109, "inventoryItemListSize" : 3 }] }