Get familiar with the Django web interface.
The Juniper Mist API is built on a Django Representational State Transfer (REST) framework.
This architecture allows for a browsable API, meaning that you can interact with APIs
directly from a web browser. This API allows for increased usability and flexibility by
enabling you and other users to perform CRUD operations within the API. In a sense, the
Django interface acts like a RESTful client. This function is handy for executing CRUD
operations on a single API object.
To make a change to a configuration object, you must be logged in to the Juniper Mist
portal and know the URL API path of the object. Consult the API documentation for details and parameters for
changing objects. You will find the URL API paths for all objects available.
This task walks you through how to get device information from an access point (AP) and
rename the AP directly from the Django interface.
To use the Django web interface to make API changes:
-
Log in to the Juniper Mist portal.
-
Open the API URL for a specific device:
https://<api-endpoint>/api/v1/sites/<site_id>/devices?name=<device
name>. The device name is case-sensitive.
Note:
When reusing code blocks, replace placeholder values with actual values, such as your
API token, organization ID, site ID, AP name, and so on.
In this case, the URL will look like this (portions of the site_id are omitted):
https://{api-host}/api/v1/sites/c1947558-268d-4d31-xxxx-xxxxxxxxxxxx/devices?name=TEST-rename
The browser issues the following command through the Django interface:
GET /api/v1/sites/c1947558-268d-4d31-xxxx-xxxxxxxxxxxx/devices?name=TEST-rename
Juniper Mist assigns every device a unique identifier, which is typically based on the
MAC address (00000000-0000-0000-1000-<device_mac>). In the context of the device
API, it is called id. You need to reference the AP using
id so the API knows which specific device to rename.
-
To make the change, insert the device ID (
id) into the API call and
display it in the browser.
The new call will look like this:
https://api.mist.com/api/v1/sites/c1947558-268d-4d31-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-5c5b3xxxxxxx
The
output is the same as the previous request; however, the API context now enables you to
make a change to the specific device based on the
id and not the name.
Notice the lack of enclosing “[ ]” brackets.
-
Enter the JavaScript Object Notation (JSON)-formatted text in the
Content input box for the intended AP rename call. You do not
need to include the unique device ID (
id) because the id
context exists in the URL.
-
Once complete, press
PUT to push the request to Juniper Mist. The
results should look like this, indicating that the AP has been renamed:
{
"id": "00000000-0000-0000-1000-5c5b3xxxxxx",
"name": "RENAMED",
"site_id": "c1947558-268d-4d31-xxxx-xxxxxxxxxxxx",
"org_id": "3f12cb79-fb5e-4d4b-xxxx-xxxxxxxxxxxx",
"created_time": 1685989351,
"modified_time": 1686321430,
"map_id": null,
"mac": "5c5b3xxxxxxxx",
"serial": "A07451xxxxxxx",
"model": "AP43",
"hw_rev": "C02",
"type": "ap",
"tag_uuid": "3f12cb79-fb5e-4d4b-xxxx-xxxxxxxxxxxxxx",
"tag_id": 3056xxx,
"evpntopo_id": null,
"deviceprofile_id": null
}
For more information, see the Site section of the API Documentation site.