get_mappings
Specification¶
- Description:
-
Matches identifiers to mappings for a particular key field. Seeexample.
-
URL:
https://uslicer.iponweb.com/API/v2/get_mappings
-
URL arguments:
-
None
-
POST arguments (required unless marked optional):
-
slicer_name
: the name of the report. project_name
: the name of the project.token
: the authorization token (see Authentication).search_mappings
: an array with the following structure:- [ {"key": "key_field",
- "values": ["value1", ... ]},...],
where "values" is an array of key field identifiers to search mappings for, and "key_field" is the name of the key field.
- Output:
status
: the status of the request.success
, if the request was processed successfully, or error code, if any error occurred. If the status is notsuccess
, then the response contains thestatus
andreason
fields only. Possible values:success
: the request was processed successfully.bad_request
: invalid request parameters, please see thereason
field for more details.timeout
: the request took too long to complete.access_error
: the user doesn't have access to the specified project/slicer, or a wrong token was used.internal_error
: the request failed due to an unknown problem.
reason
: user-friendly description of the occurred error. This field is displayed for failed requests only.mappings
: a list ofkey field value
/key field value mapping
pairs with the following structure:- {"key_field":
- {"value1: "mapping1",...},...}
Example¶
Purpose: Get mappings for the US and CA values of the geo-country
key field.
Path:
https://uslicer.iponweb.com/API/v2/get_mappings
POST Arguments:
{
"slicer_name": "Traffic Demo",
"project_name": "demo",
"token": "<token>",
"search_mappings": [
{
"key": "geo_country",
"values": [
"US", "CA"
]
}
]
}
Command:
curl --data '{ "slicer_name": "Traffic Demo", "project_name": "demo", "token": "<token>", "search_mappings": [{"key": "geo_country", "values":["US", "CA"]}]}' -H "Content-Type: application/json" -H "Accept: application/json" "https://uslicer.iponweb.com/API/v2/get_mappings"
Response:
{
"mappings" : {
"geo_country" : {
"US" : "United States",
"CA" : "Canada"
}
},
"status" : "success"
}