Page API
This article displays API calls available for App (Portal Page) configuration:
-
/api/page
: Allows retrieving, creating, updating, and deleting Apps, downloading assets from an App, and uploading assets to an App.
Prerequisites:
- Set up API access
- Verify that you have API access and obtain a token via get_token call
Table of contents:
1. Access Admin > System > API Toolkit
2. Retrieve Apps
- The GET request to
/api/page
returns all Apps (Portal Pages) data. - The GET request to
/api/page/id/<ID>
returns the selected App data
- Item: page
- Method: GET
- Optionally, filter the results by:
- ID: Enter the App ID
- internal_name: Enter the Internal Name of the App
- Enter an API Token
- [Run request]
Example Response
{
"pages": [
{
"id": 190,
"name": "Start",
"internal_name": "start-page",
"enabled": "Y",
"visible_in_homepage": "Y",
"template_id": 35,
"template": "main page",
"custom_domain": "subdomain.company.com",
"base_url": "https://docs.metricinsights.com/p/start-page",
"groups": []
},
{
"id": 114,
"name": "Sales KPIs",
"internal_name": "SalesKPIs",
"enabled": "Y",
"visible_in_homepage": "Y",
"template_id": null,
"template": null,
"custom_domain": null,
"base_url": "https://docs.metricinsights.com/p/sales-kpis",
"groups": [
{
"group_id": 63,
"name": "Robert Group"
}
]
}
]
}
Fields Description
Parameter Name | Value Type | Description |
---|---|---|
id | integer | The ID of the App |
name | string | The name of the App |
internal_name | string | The Internal Name of the App used in URL |
enabled | string | Whether the App is enabled.
|
visible_in_homepage | string | Whether the App is displayed on the homepage.
|
template_id |
integer |
The ID of the App's Template |
template |
string |
The name of the App's Template |
custom_domain |
string |
The Custom Domain of the App |
base_url |
string |
The URL of the App |
groups |
array | An array of objects representing Groups with access to the App |
Below are the Group object parameters from the groups array: | ||
group_id |
integer |
The ID of the Group with access to the App |
name |
string |
The name of the Group with access to the App |
3. Create New App
The POST request to /api/page
creates a new App.
- Item: page
- Method: POST
-
ID: Enter the ID of an existing App
- See Retrieve Apps for details
- Select JSON request and modify the request body by providing the following values:
- enabled: Whether or not the App is enabled
- name: The name of the App
-
internal_name: The name used in the App's URL
- NOTE: Letters, numbers, dashes and underscores are the only supported characters for Apps' URL names
- visible_in_homepage: Whether the App is displayed on the homepage
- Enter an API Token
- [Run request]
4. Delete App
The DELETE request to /api/page/id/<page_id>
deletes the selected App.
- Item: page
- Method: DELETE
- ID: Enter the ID of the App that needs to be deleted
- Enter an API Token
- [Run request]
5. Download App Assets
The GET request to /api/page/id/<app_id>/asset/download
downloads a .zip file with App's assets.
Example:
$.ajax({
url: "https://test.metricinsights.com/api/page/id/19/asset/download",
method: "GET",
headers: {
"Authorization": "...",
"Cookie": "...",
}
});
6. Upload App Assets
The POST request to /api/page/id/<app_id>/asset/upload
uploads a .zip file with App's assets.
Example:
const form = new FormData();
form.append("file", fileInput.files[0], "C:/Users/Robert/Downloads/assets.zip");
$.ajax({
url: "https://test.metricinsights.com/api/page/id/81/asset/upload",
method: "POST",
headers: {
"Authorization": "...",
"Cookie": "...",
},
processData: false,
contentType: false,
data: form
});