Mapping Lookup Rest Apis

Note: This page has not yet been converted to the new developer portal format. Please use Swagger to test this API.

Mapping Lookup REST APIs

GET /lookup/{organizationId}/mappings/search?currentPageNo={currentPageNo}&pageSize={pageSize}&sort={sort}&groups={groupId(s)}&{attribute1_value(s)}&{attribute2_name}={attribute2_value(s)}&...

Description

Gets all the CMDB lookup mappings for the given Organization ID.

URL

/lookup/{organizationId}/mappings/search

Method

GET

URL Parameters

ParameterMandatoryTypeDefault ValueDescription

organizationId

Yes

long

-

The ID of the organization.

currentPageNo

No

int

1

Page number used to scroll through the mapping records.

pageSize

No

int

20

Number of mapping records on the page.

sort

No

String

+lastUpdatedOn

Sort the mapping records based on the time stamp of the last update. Prefix “-” gets most recently updated records first, and prefix “+” vice versa.

groupId(s)

No

String

-

String of one or more Group IDs (comma-separated).

attributeN_name

No

String

-

Attribute name to be used as query param.

attributeN_value(s)

No

String

-

String of one or more values (comma-separated).

Responses

CodeResponse

200

◊ Mappings for the given Organization ID.
{
"currentPageNo": 1,
"totalPageCount": 1,
"totalCount": 13,
"pageSize": 25,
"data": [
{
"id": "5aaad496d4131874891468b1",
"organizationId": 888409690212728,
"deleted": false,
"targetGroups": [
{
"id": 466197225487156,
"name": "Database Server"
}
],
"attributes": [
{
"name": "Property7",
"values": [
"10"
]
},
{
"name": "Location",
"values": [
"NY"
]
}
],
"createdBy": "xyz",
"lastUpdatedBy": "xyz",
"lastUpdatedOn": "2018-03-15T20:16:22.403Z"
},
{
"id": "5aa30a06d413182cf71b767f",
"organizationId": 888409690212728,
"deleted": false,
"targetGroups": [
{
"id": 466197225487153,
"name": "All Management"
}
],

"attributes": [
{
"name": "Services",
"values": [
"Apps"
]
},
{
"name": "Group Type",
"values": [
"Accountable team"
]
},
{
"name": "Priority2",
"values": [
"P1"
]
},
{
"name": "Product",
"values": [
"Dell"
]
},
{
"name": "Location",
"values": [
"Boston"
]
}
],
"createdBy": "xyz",
"lastUpdatedBy": "xyz",
"lastUpdatedOn": "2018-03-09T22:26:14.364Z"
},
.
.
.
// other existing records within the pageSize limit
]
}
◊ No mappings available for the given Organization ID.
{
"currentPageNo": 1,
"totalPageCount": 1,
"totalCount": 0,
"pageSize": 25,
"data": []
}

401

◊ Invalid JWT access token.
{
"code": 401,
"message": "Unauthorized"
}
◊ No organization access to the User.
{
"status": 401,
"message": "Org 888409690212728 not accessible to this user, or does not exist."
}

POST /lookup/{organizationId}/mappings

Description

Creates a new mapping for the given Organization ID.

URL

/lookup/{organizationId}/mappings

Method

POST

URL Parameters

ParameterMandatoryTypeDefault ValueDescription

organizationId

Yes

Long

-

The ID of the organization.

Request Body

Responses

CodeResponse

200

◊ Created LookupMapping object.
{
"data": {
"id": "5aac1133d413187489146a4f",
"organizationId": 888409690212728,
"deleted": false,
"targetGroups": [
{
"id": 466197225487138,
"name": "IT Support Desk"
},
{
"id": 466197225487143,
"name": "ITSecOps Team"
}
],
"attributes": [
{
"name": "Location",
"values": [
"Pasadena"
]
},
{
"name": "Group Type",
"values": [
"Resolver"
]
},
{
"name": "Product",
"values": [
"Dell"
]
},

{
"name": "Product",
"values": [
"Hardware"
]
},
{
"name": "Services",
"values": [
"Apps"
]
}
],
"createdBy": "Paulomi Mahidharia",
"lastUpdatedBy": "Paulomi Mahidharia",
"lastUpdatedOn": "2018-03-16T18:47:15.918Z"
}
}

400

◊ No attributes passed in the mapping.
{
"errors": [
{
"codes": [
"NotEmpty.resourceObject.data.attributes",
"NotEmpty.data.attributes",
"NotEmpty.attributes",
"NotEmpty.java.util.List",
"NotEmpty"
],
"arguments": [
{
"codes": [
"resourceObject.data.attributes",
"data.attributes"
],
"defaultMessage": "data.attributes",
"code": "data.attributes"
}
],
"defaultMessage": "may not be empty",
"objectName": "resourceObject",
"field": "data.attributes",
"rejectedValue": [],
"bindingFailure": false,
"code": "NotEmpty"
}
]
}
◊ No Target Groups passed in the mapping.
{
"errors": [
{
"codes": [
"NotEmpty.resourceObject.data.targetGroups",
"NotEmpty.data.targetGroups",
"NotEmpty.targetGroups",
"NotEmpty.java.util.List",
"NotEmpty"
],
"arguments": [
{
"codes": [
"resourceObject.data.targetGroups",
"data.targetGroups"
],
"defaultMessage": "data.targetGroups",
"code": "data.targetGroups"
}
],

"defaultMessage": "may not be empty",
"objectName": "resourceObject",
"field": "data.targetGroups",
"rejectedValue": [],
"bindingFailure": false,
"code": "NotEmpty"
}
]
}

401

◊ Invalid JWT access token.
{
"code": 401,
"message": "Unauthorized"
}
◊ No organization access to the User.
{
"status": 401,
"message": "Org 888409690212728 not accessible to this user, or does not exist."
}

500

◊ Trying to create an existing mapping.
{
"timestamp": 1521490651522,
"status": 500,
"error": "Internal Server Error",
"exception": "org.springframework.dao.DuplicateKeyException",
"message": "Write failed with error code 11000 and error message 'E11000 duplicate key error collection: coredb.lookupMapping index: id dup key: { : ObjectId('5ab019e6d4131838e80a80db') }'; nested exception is com.mongodb.DuplicateKeyException: Write failed with error code 11000 and error message 'E11000 duplicate key error collection: coredb.lookupMapping index: id dup key: { : ObjectId('5ab019e6d4131838e80a80db') }'",
"path": "/lookup/888409690212728/mappings"
}

GET /lookup/{organizationId}/mappings/{mappingId}

Description

Gets the mapping for the given Organization Id and Mapping ID.

URL

/lookup/{organizationId}/mappings/{mappingId}

Method

GET

URL Parameters

ParameterMandatoryTypeDefault ValueDescription

organizationId

Yes

Long

-

The ID of the organization.

mappingId

Yes

String

-

◊ The ID of the mapping.

Responses

CodeResponse

200

◊ LookupMapping object.
{
"data": {
"id": "5a58faecd4131828ab9dbdc3",
"organizationId": 888409690212728,
"deleted": false,
"targetGroups": [
{
"id": 884011643732460,
"name": "After Action"
}
],
"attributes": [
{
"name": "Services",
"values": [
"Database"
]
},
{
"name": "Priority2",
"values": [
"P2"
]
},
{
"name": "Group Type",
"values": [
"Informedf"
]
},
{
"name": "Location",
"values": [
"NY", "Boston"
]
}
],
"createdBy": "xyz",
"lastUpdatedBy": "Paulomi Mahidharia",
"lastUpdatedOn": "2018-03-16T15:37:32.395Z"
}
}

401

◊ Invalid JWT access token.
{
"code": 401,
"message": "Unauthorized"
}
◊ No organization access to the User.
{
"status": 401,
"message": "Org 888409690212728 not accessible to this user, or does not exist."
}

404

◊ Incorrect mappings ID passed.
// No response body

PUT /lookup/{organizationId}/mappings/{mappingId}

Description

Updates the mapping for the given Organization ID and Mapping ID.

URL

/lookup/{organizationId}/mappings/{mappingId}

Method

PUT

URL Parameters

ParameterMandatoryTypeDefault ValueDescription

organizationId

Yes

Long

-

The ID of the organization.

mappingId

Yes

String

-

◊ The ID of the mapping.

Request Body

Responses

CodeResponse

200

◊ Updated LookupMapping object.
{
"data": {
"id": "5ab019e6d4131838e80a80db",
"organizationId": 888409690212728,
"deleted": false,
"targetGroups": [
{
"id": 466197225487138,
"name": "IT Support Desk"
},
{
"id": 466197225487143,
"name": "ITSecOps Team"
}
],
"attributes": [
{
"name": "Location",
"values": [
"Pasadena"
]
},
{
"name": "Group Type",
"values": [
"Resolver"
]
},
{
"name": "Product",
"values": [
"Dell"

]
},
{
"name": "Product",
"values": [
"Hardware"
]
},
{
"name": "Services",
"values": [
"Apps"
]
}
],
"lastUpdatedBy": "Jane.Doe",
"lastUpdatedOn": "2018-03-19T20:15:29.388Z"
}
}

401

◊ Invalid JWT access token.
{
"code": 401,
"message": "Unauthorized"
}
◊ No organization access to the User.
{
"status": 401,
"message": "Org 888409690212728 not accessible to this user, or does not exist."
}

404

◊ Incorrect mappings ID passed.
// No response body

DELETE /lookup/{organizationId}/mappings/{mappingId}

Description

Deletes the mapping for the given Organization ID and Mapping ID.

URL

/lookup/{organizationId}/mappings/{mappingId}

Method

DELETE

URL Parameters

ParameterMandatoryTypeDefault ValueDescription

organizationId

Yes

Long

-

The ID of the organization.

mappingId

Yes

String

-

◊ The ID of the mapping.

Responses

CodeResponse

200

◊ Mapping deleted successfully.
{
"data": "Mapping was deleted successfully"
}

401

◊ Invalid JWT access token.
{
"code": 401,
"message": "Unauthorized"
}
◊ No organization access to the User.
{
"status": 401,
"message": "Org 888409690212728 not accessible to this user, or does not exist."
}

404

◊ Incorrect mappings ID passed.
// No response body