Access Data Center Assurance Using APIs
This topic describes how to use REST API requests to read and monitor network resources from Data Center Assurance.
Data Center Assurance API Architecture
The API architecture of Data Center Assurance supports monitoring the performance of applications, services, and devices from the Data Center Assurance portal. Many of the monitoring actions that you can do in the portal, you can automate at scale by using APIs. APIs allow for a defined and faster way for machines to communicate with each other.
Many enterprise networks have existing workflows and systems to manage their network infrastructure. The ability to integrate Data Center Assurance to these workflows provides developers with access to the monitoring capabilities of DC Assurance.
The API endpoints for Data Center Assurance are designed in accordance with Representational State Transfer (REST) architectural principles, using standard HTTP methods, status codes, and JavaScript Object Notation (JSON)-based payloads to ensure simplicity, interoperability, and ease of adoption. The REST API exposes a set of well-defined, resource-oriented endpoints that allow you to programmatically access, manage, and automate key functions of the platform.
Currently, the REST APIs can be used to perform the same action as the Data Center Assurance dashboards to read and monitor some of the resources in the network infrastructure using the GET method.
Run API Requests on DC Assurance
To run API requests on DC Assurance by using REST APIs, you should be familiar working with tools such as Postman or CURL. This workflow shows how to monitor data on an organization using the Postman application.
You will need the following parameters to monitor network devices:
- The URL to the environment where Data Center Assurance is running
- ID of the organization that you want to monitor
- Username for accessing the organization
- Password for accessing the organization
To access DC Assurance using API requests on Postman:
Sample Output for an API Request to DC Assurance
The following is an example of an API request sent to DC Assurance with additional parameters:
GET https://dc.ai.juniper.net/api/v1/datacenter/orgs/86a5c86d-ce29-480d-94dd-b3427cbb8f85/inventory/systems?filter=role eq 'SYSTEM_ROLE_LEAF'&sort=name&expand=site&limit=5
The following is the output received from DC Assurance along with a 200
OK HTTP response:
{
"systems": [
{
"id": "8c83eaf7-92f7-5b09-961a-439b3f85010e",
"name": "_cf_rack_001_leaf1",
"site": {
"id": "5aa48353-5c6a-4d26-b82f-a88659edc2b4",
"name": "PSE_Lab-DC3-Collapsed-Fabric"
},
"role": "SYSTEM_ROLE_LEAF",
"type": "SYSTEM_TYPE_SWITCH",
"hostname": "cf-rack-001-leaf1",
"vendor": "Juniper",
"model": "QFX5120-32C"
},
{
"id": "a0d52952-f1ec-55b3-8b5a-aaa9ba9d7db7",
"name": "_cf_rack_001_leaf2",
"site": {
"id": "5aa48353-5c6a-4d26-b82f-a88659edc2b4",
"name": "PSE_Lab-DC3-Collapsed-Fabric"
},
"role": "SYSTEM_ROLE_LEAF",
"type": "SYSTEM_TYPE_SWITCH",
"hostname": "cf-rack-001-leaf2",
"vendor": "Juniper",
"model": "QFX5120-32C"
},
{
"id": "caf2e1f8-03c8-52c2-8bb2-1c4e3ee529dc",
"name": "comp-leaf-qfx5110-01",
"site": {
"id": "dc79edc2-ce19-4ebd-b2ad-a89be3551279",
"name": "PSE_Lab-DC1-5-Stage"
},
"role": "SYSTEM_ROLE_LEAF",
"type": "SYSTEM_TYPE_SWITCH",
"hostname": "comp-leaf-qfx5110-01",
"vendor": "Juniper",
"model": "QFX5110-48S-4C"
},
{
"id": "9f0c1e43-4f9f-55c4-97a7-7868b15c03d7",
"name": "comp-leaf-qfx5110-02",
"site": {
"id": "dc79edc2-ce19-4ebd-b2ad-a89be3551279",
"name": "PSE_Lab-DC1-5-Stage"
},
"role": "SYSTEM_ROLE_LEAF",
"type": "SYSTEM_TYPE_SWITCH",
"hostname": "comp-leaf-qfx5110-02",
"vendor": "Juniper",
"model": "QFX5110-48S-4C"
},
{
"id": "d3fa9199-949e-5258-a166-84954d00aa49",
"name": "dc2-bl",
"site": {
"id": "8dbbc4ee-1c23-4981-8489-5a804fce8dc7",
"name": "PSE_Lab-DC2-3-Stage"
},
"role": "SYSTEM_ROLE_LEAF",
"type": "SYSTEM_TYPE_SWITCH",
"hostname": "dc2-bl",
"vendor": "Juniper",
"model": "QFX5130-32CD"
}
]
}