Pricefx REST API Reference
- SQL Query a Data Manager Object
The Pricefx Backend API
Set this parameter to override the default timeout (60 seconds) of the query. The maximum allowed timeout is 300 seconds. The default timeout value and the maximum timeout value can be configured in the backend. Setting higher timeout can be useful, for example, when a query takes long time (e.g., when processing large tables).
- Mock serverhttps://api.pricefx.com/_mock/openapi/reference/pricefx-server_openapi/datamart.query
- URL:https://companynode.pricefx.com/pricefx/companypartition/datamart.query
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
'https://api.pricefx.com/_mock/openapi/reference/pricefx-server_openapi/datamart.query?timeout=20' \
-H 'Content-Type: application/json' \
-d '{
"operationType": "fetch",
"startRow": 0,
"endRow": 100000,
"sortBy": [],
"textMatchStyle": "exact",
"data": {
"query": {
"name": null,
"datamart": "DM.TransactionsDM",
"label": "Series1",
"source": "DM.TransactionsDM",
"projections": {
"bandBy": {
"alias": "bandBy",
"expression": "CustomerID",
"function": "",
"parameters": {},
"name": "CustomerID",
"label": "CustomerID"
},
"bubbleSize": {
"alias": "bubbleSize",
"expression": "SUM({field})",
"function": null,
"parameters": {
"field": "Quantity",
"quantity": "Quantity",
"base": "ListPrice"
},
"name": "Quantity",
"label": "∑Quantity",
"default": null,
"advancedProjection": true,
"formatString": "∑{field}"
},
"bubbleSize_n": {
"alias": "bubbleSize_n",
"expression": "SUM({field})",
"function": null,
"parameters": {
"field": "Quantity",
"quantity": "Quantity",
"base": "ListPrice"
},
"name": "Quantity",
"label": "∑Quantity (norm)",
"default": null,
"advancedProjection": true,
"formatString": "∑{field}"
},
"groupBy": {
"alias": "groupBy",
"expression": "Region",
"function": "",
"parameters": {},
"name": "Region",
"label": "Region"
},
"x": {
"alias": "x",
"expression": "SUM({field})",
"function": null,
"parameters": {
"field": "BasePrice",
"quantity": "Quantity",
"base": "ListPrice"
},
"name": "BasePrice",
"label": "∑BasePrice",
"default": null,
"advancedProjection": true,
"formatString": "∑{field}"
},
"y": {
"alias": "y",
"expression": "SUM({field})/SUM({quantity})",
"function": null,
"parameters": {
"field": "ListPrice",
"quantity": "Quantity",
"base": "ListPrice"
},
"name": "ListPrice",
"label": "∑ListPrice/∑Quantity",
"default": null,
"advancedProjection": true,
"formatString": "∑{field}/∑{quantity}"
}
},
"options": {
"currency": "EUR",
"regression": [
"y",
"x"
],
"distribution": [
"m1",
"x",
"y"
],
"normalization": [
"bubbleSize_n"
]
},
"filter": {
"criteria": [],
"operator": "and",
"_constructor": "AdvancedCriteria"
},
"aggregateFilter": null,
"dimensionFilters": [],
"limit": null,
"rollup": true,
"sortBy": []
}
},
"oldValues": null
}'{ "response": { "node": "e2e-staging-node", "startRow": 0, "data": [ … ], "endRow": 3, "totalRows": 3, "status": 0 } }
Request
Processes and queries data from Price Analyzer or Price Optimizer. The queries can be aggregated, do various computations including statistical projections. Supports filtering.
Set this parameter to override the default timeout (60 seconds) of the query. The maximum allowed timeout is 300 seconds. The default timeout value and the maximum timeout value can be configured in the backend. Setting higher timeout can be useful, for example, when a query takes long time (e.g., when processing large tables).
sources that SQL can use are query definitions. The sources become CTEs (Common Table Expression) in the final SQL. These are then used as a reference in the main query instead of referring to the actual tables directly. The request example compares the volume by month 2019 to 2020.
- Mock serverhttps://api.pricefx.com/_mock/openapi/reference/pricefx-server_openapi/datamart.sqlquery
- URL:https://companynode.pricefx.com/pricefx/companypartition/datamart.sqlquery
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
'https://api.pricefx.com/_mock/openapi/reference/pricefx-server_openapi/datamart.sqlquery?timeout=20' \
-H 'Content-Type: application/json' \
-d '{
"operationType": "fetch",
"startRow": 0,
"endRow": 10000,
"data": {
"sources": {
"s0": {
"query": {
"source": "DM.InvoicesDM",
"projections": {
"Month": {
"expression": "Invoice_DateMonth"
},
"Quantity": {
"expression": "SUM({field})",
"parameters": {
"field": "Sales_Quantity"
},
"advancedProjection": true
}
},
"options": {
"currency": "EUR"
},
"filter": {},
"aggregateFilter": null,
"dimensionFilters": [
{
"Invoice_DateYear": [
"2019"
]
}
],
"rollup": true
}
},
"s1": {
"query": {
"source": "DM.InvoicesDM",
"projections": {
"Month": {
"expression": "Invoice_DateMonth"
},
"Quantity": {
"expression": "SUM({field})",
"parameters": {
"field": "Sales_Quantity"
},
"advancedProjection": true
}
},
"options": {
"currency": "EUR"
},
"filter": {},
"aggregateFilter": null,
"dimensionFilters": [
{
"Invoice_DateYear": [
"2020"
]
}
],
"rollup": true
}
}
},
"with": {
"w0": "SELECT Month FROM (VALUES ('\''M01'\''), ('\''M02'\''), ('\''M03'\''), ('\''M04'\''), ('\''M05'\''), ('\''M06'\''), ('\''M07'\''), ('\''M08'\''), ('\''M09'\''), ('\''M10'\''), ('\''M11'\''), ('\''M12'\'')) AS t(Month)"
},
"sql": "SELECT w0.Month \"Month\", SUM(s0.quantity) \"Volume 2019\", SUM(s1.quantity) \"Volume 2020\", 100 * (SUM(s1.quantity) / SUM(s0.quantity) - 1.0) \"VolumeΔ%\" FROM w0 LEFT OUTER JOIN s0 ON w0.Month = RIGHT(s0.Month,3) LEFT OUTER JOIN s1 ON w0.Month = RIGHT(s1.Month,3) GROUP BY w0.Month ORDER BY w0.Month"
}
}'{ "response": { "node": "e2e-staging-node", "startRow": 0, "data": [ … ], "endRow": 3, "totalRows": 3, "status": 0 } }
- Mock serverhttps://api.pricefx.com/_mock/openapi/reference/pricefx-server_openapi/datamart.getrollups
- URL:https://companynode.pricefx.com/pricefx/companypartition/datamart.getrollups
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
https://api.pricefx.com/_mock/openapi/reference/pricefx-server_openapi/datamart.getrollups \
-H 'Content-Type: application/json' \
-d '{
"operationType": "fetch",
"startRow": 0,
"endRow": null,
"textMatchStyle": "substring",
"data": {
"fieldName": "owner",
"operator": "equals",
"value": null,
"_constructor": "AdvancedCriteria"
},
"oldValues": null
}'{ "response": { "status": 0, "startRow": 0, "node": "string", "data": [ … ], "endRow": 0 } }
See the Key-Value Database Storage Knowledge Base article for more details.
Here you can find all fields of the corresponding entity (represented by the type code).
Use the /metadata.describe endpoint to find out the correct data type of the field that is used in your partition.
Comments