Using Admin API Demo: Examples
CDP Data Visualization's URL-based Admin API can easily display the data format for each item type.
The demo has a tab for each enabled item type, and supports all the API functions: Fetch (one), Fetch All, Create, Update, and Delete.
The following examples demonstrate some of the functions available through the demo.
Fetching All User Information
To get information on all users, simply click Fetch. CDP Data Visualization returns the list of registered users, as demonstrated by the following screenshot.
Fetching Single User Information, With Detail
The following steps shows how to extract information on a single item using its ID or name. The following image is a screen shot of extracting information on a single item using its ID, and contains the actions available for single items: Update, Clone, and Delete.
- Under the Users tab, enter the ID.
- Select the Detail option to get the full data for that item, in this case user ID 1.
- Click Fetch.
Cloning an Item
When you Clone an item, the resulting screen shows a duplicate of the item, but clears the ID field. This is a partial operation; see Creating a New Item.
Creating a New Item
If you click Create at this time (after Cloning an Item), CDP Data Visualization returns an error, because a user with this name already exists.
When you change the username, you must also supply the initial password.
Here, we created a new user by changing the
username and adding an extra line that
"username": "user2-copy", "password": "initial-pw",
When you click Create now, CDP Data Visualization notifies you that your update is successful, and refreshes the interface to show the results consistent with fetching detailed information for a specific user, as described in Fetching Single User Information, With Detail.
Note that for security reasons, the password is not included in the fetched user details.
To change the user's password, you must supply both the current password
password) and the new password
Edit the user detail by adding the following two lines of code, and click Update.
"password": "initial-pw", "new_password": "updated-pw",