save_column
Specification¶
- Description:
-
Creates or modifies a user-defined data column. See example.
-
URL:
-
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).description
: user-defined data column full name.access
: access permission. Possible values:shared/
private
.formula
: data field value calculation logic, can containoperators
andoperands
.operators
: operators supported in formulas. Possible values: +, -, *, /, ().operands
: operands supported in formulas. Possible values: data fields returned by theAPI/v2/info
method.
name
(optional): data column name. Absent if a new data column is being created, present if an existing data column is being modified.display_type
(optional): data column value display type. Possible values:int
,float
,percent
. The default value isint
.display_precision
(optional): the number of decimal places to be displayed. Possible values: integer values in the range of0..6.
.show_percents
(optional): defines whether percent should be displayed for the data column values. Possible values:0
(do not display percent),1
(display percent only at sorting by this column),2
(Always display percent). The default value is0
.is_optional
(optional): defines whether the data column should be selected when the default selection of data columns is applied. Possible values:1
(select),0
(do not select). The default value is0
.-
display_pattern
(optional): allows to set display_patterns for custom column values. Format:any_characters{}any_characters
, where{}
represents custom column 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 notsuccess
, then the response contains thestatus
andreason
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.name
: data column name.
Example¶
Purpose: Create a custom data column with the following parameters:
- Formula: imps/bids
- Data type: float
- Number of displayed decimal places: 3
- Percent is not displayed
- Data column is selected by default
Path:
https://uslicer.iponweb.com/API/v2/save_column
POST Arguments:
{
"slicer_name": "Traffic Demo",
"project_name": "demo",
"token": "<token>",
"description" : "custom",
"access" : "shared",
"formula" : "imps/bids",
"display_type": "float",
"display_precision" :"3",
"show_percents": "0",
"is_optional": "0"
}
Command:
curl -d'{"slicer_name": "Traffic Demo","project_name": "demo","token": "<token>","description":"custom","access":"shared","formula":"imps/bids","display_type":"float","display_precision":"3","show_percents":"0","is_optional":"0"}' "https://uslicer.iponweb.com/API/v2/save_column"
Response:
{
"status" : "success",
"name" : "custom_column_2211"
}