Asset Type REST Services

Listing all asset types

Method

GET
URL/rest/jip-api/1.0/form/list.json


Sample Response
[
  {
    "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 asset type

MethodGET
URL/rest/jip-api/1.0/form/[formId].json


Sample Response
{
  "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 Message
{
  "success":false,
  "message":"Could not find form with id:[formId]"
}

Create a new asset type

MethodPOST
URL/rest/jip-api/1.0/form.json


Request Body
{
  "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 asset type

MethodPUT
URL/rest/jip-api/1.0/form/[formId].json


Request Body
{
  "formName": "My new form name"
}
Success Message
{
  "success": true,
  "message": "Form[formId] updated successfully"
}
Failure message
{
  "success": false
  "message": "[formName] should not be empty"
}
{
  "success": false
  "message": "Could not find form with id:[formId]"
}

Delete asset type

MethodDELETE
URL/rest/jip-api/1.0/form/[formId].json


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