Create a new transaction report
POST
{{baseUrl}}/api/model/transactionReports
Create a new transaction report based on the definition provided in request body. The definition of the newly created transaction report is returned in response and will be saved to metadata at the same time. The definition includes information
and table
. The project ID is required to create a report in metadata. An authorization token is required to execute the request and can be obtained using Authentication endpoints.
Body
PARAM
Key |
Datatype |
Required |
Description |
HEADERS
Key |
Datatype |
Required |
Description |
X-MSTR-AuthToken
|
string |
|
|
X-MSTR-ProjectID
|
string |
|
|
RESPONSES
status
curl -X POST 'baseUrl/api/model/transactionReports' -H 'X-MSTR-AuthToken: authToken' -H 'X-MSTR-ProjectID: projectId' -d '{"information":{"name":"New Transaction Report","destinationFolderId":"D3C7D461F69C4610AA6BAA5EF51F4125"},"table":{"physicalTable":{"columns":[{"name":"Opportunity (ID)","dataType":{"type":"integer","precision":4,"scale":0},"required":true},{"name":"Opportunity (DESC)","dataType":{"type":"fixed_length_string","precision":255,"scale":0},"required":true},{"name":"Competitor (ID)","dataType":{"type":"fixed_length_string","precision":255,"scale":0},"required":false},{"name":"Opportunity_Size","dataType":{"type":"double","precision":18,"scale":0},"required":true}],"sqlExpression":{"tree":{"function":"concat_no_blank","children":[{"function":"repeat","functionProperties":[{"name":"Distinct","value":{"type":"boolean","value":"true"}}],"children":[{"type":"constant","variant":{"type":"string","value":" \r\n\r\nUPDATE F_SALES_OPPTY\r\nSET\r\nOPPTY_NAME = "}},{"type":"constant","variant":{"type":"string","value":"#1"}},{"type":"constant","variant":{"type":"string","value":",\r\n"}},{"function":"apply_optional","children":[{"type":"constant","variant":{"type":"string","value":"COMPETITOR = #2,"}}],"type":"operator"},{"type":"constant","variant":{"type":"string","value":"\r\nOPPTY_SIZE = "}},{"type":"constant","variant":{"type":"string","value":"#3"}},{"type":"constant","variant":{"type":"string","value":"\nWHERE\r\nOPPTY_ID = "}},{"type":"constant","variant":{"type":"string","value":"#0"}},{"type":"constant","variant":{"type":"string","value":"\r\n\r\n"}}],"type":"operator"}],"type":"operator"}}},"attributes":[{"id":"82E57B1D48B416E10CD0CAB07A1D5613","name":"Opportunity","forms":[{"id":"45C11FA478E745FEA08D781CEA190FE5","category":"ID","type":"system","displayFormat":"number","expression":{"tree":{"type":"column_reference","name":"Opportunity (ID)"}}},{"id":"CCFBE2A5EADB4F50941FB879CCF1721C","category":"DESC","type":"system","displayFormat":"text","expression":{"tree":{"type":"column_reference","name":"Opportunity (DESC)"}}}]},{"name":"Competitor","forms":[{"id":"45C11FA478E745FEA08D781CEA190FE5","category":"ID","type":"system","displayFormat":"text","expression":{"tree":{"type":"column_reference","name":"Competitor (ID)"}}}]}],"metrics":[{"id":"C4A3B2134183C04167EAF481EEB41999","name":"Opportunity_Size","dataType":{"type":"numeric","precision":0,"scale":0},"expression":{"tree":{"type":"column_reference","name":"Opportunity_Size"}}}],"dataSource":{"objectId":"BCB3836D4C70EDF53CB706ABA556B44B","subType":"db_role","name":"Operational Datamart"}}}'