Skip to content

save_calc_mappings

Specification

  • Description:
  • Creates or updates calculation mappings. See example.

  • URL:

  • https://uslicer.iponweb.com/API/v2/save_calc_mappings

  • URL arguments:

  • None

  • POST arguments (required unless marked optional):

  • project_name: the name of the project.

  • token: the authorization token (see Authentication).
  • name: mapping name (used in formulas as a link), unique across each project.
  • mapped_key: mapped key name.
  • mappings: an array of dictionaries with the following structure:

    • key: mapping key.
    • value: mapping value.
  • 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 not success, then the response contains the status and reason fields only. Possible values:
    • success: the request was processed successfully.
    • bad_request: invalid request parameters, please see the reason 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.

Example

Purpose: Create a calculation mapping for the NLUS and (empty value) values of the geo_ country key in the demo project.

Path:

https://uslicer.iponweb.com/API/v2/save_calc_mappings

POST Arguments:

{
   "project_name": "demo",
   "token": "<token>",
   "name" : "test_mapping",
   "mapped_key" : "geo_country",
   "mappings" : [
         {
           "key": "NL",
           "value": 20
         },
         {
           "key": "US",
           "value": 10
        },
        {
          "key": null,
          "value": 56
        }
   ]
}

Command:

curl -d'{"project_name": "demo", "name": "test_mapping", "mapped_key": "geo_country", "mappings": [{"key": "NL", "value": 20}, {"key": "US", "value": 10}, {"key": null, "value": 56}], "token": "<token>"}'
"https://uslicer.iponweb.com/API/v2/save_calc_mappings"

Response:

{
   "status" : "success"
}