Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

The API returns a unique Reference Number that can be used as a payload for checking report status and downloading reports.

Resource URL
POST Method Resource URL: http://localhost:9081/sigma/rest/reports/generate

Query Parameters are as follows:

Name

Description

Sample Values

action

String indicating the action to be executed. RUN_REPORT is the default action value for running Sigma reports.

RUN_REPORT

reportId

Indicates the Report ID.

sampel0925bccf-29f0-42f2-8896-77c57a-dde-ea2198

accessToken

Indicates the access token.

sample61d74837-2e77-4ede-a967-2c84b30-dws-b3b4f 7

reportFilter

If filterId is Number and String datatypes:

  • For Contains criteria use STR_CONTAINS,

  • For in use STR_IN,

  • For Equals use STR_EQUALS.

If filterId is Date datatypes:

  • For Equals Timestamp use TDT_EQUALS,

  • For Equals use TDT_EQUALS_DATE,

  • For Financial Year use TDT_FINANCIAL_YEAR,

  • For Financial Year (w) Quarter use TDT_FINANCIAL_YEAR_QUARTER,

  • For Greater than use TDT_GT,

  • For Greater than or Equal to use TDT_GTEQUALTO,

  • For Less than use TDT_LT,

  • For Less than or Equal to use TDT_LTEQUALTO,

  • For From use TDT_RANGE,

  • For Relative Range use TDT_RELATIVE_RANGE,

For YTD use TDT_YTD.

If filterId is Long datatypes:

  • For < use NUM_LONG_LT,

  • For <= use NUM_LONG_LTEQUALTO,

  • For != use NUM_LONG_NOTEQUALTO,

  • For = use NUM_LONG_EQUALS,

  • For > use NUM_LONG_GT,

  • For >= use NUM_LONG_GTEQUALTO.

"reportFilter" : {        

"preHookParams":{"NAME":["SIGMA"]},"procedureParams":{"NAME":["SIGMA"]},"additionalParams":{"ADD_INP":["DEMO1"]}, "bindParams":{"NAME":["DEMO1"]}, "filterDef": [{"columnId": "ACCOUNT_TYPE", "filterId": "STR_CONTAINS","filterDataType": "string"     ,"filterValues": "savings","filterDescriptions":"savings"}]        

}

Note:

In order to obtain the Report ID log-on to Sigma application and right click the report on the left-hand side of the page and click Copy Report ID.


Response Parameters are as follows:

Parameter

Type

Description

replyType

string

For reply type, the report status will be returned as 'SUCCESS' if the running individual report is successful or 'FAILURE' if the report is a failure.

reportId

string

Generated reports IDs.

referenceNumber

sting

A unique reference number provided for downloading reports.

statusCode

int

Code for report status. The response error details for each HTTP code are as follows:
200 - Success
204 - Request is successful but the requested data is not available.
400 - Request syntax is incorrect or the parameters supplied were invalid.
401 - Unauthorized API.
500 - Server encountered an unexpected condition, which prevented it from fulfilling the request.

Sample Response

{
"headerMap": {
"replyType": "SUCCESS",
"reportId": " samplejk34-0925bccf-29f0-42f2-8896-77c57aea2198",
"referenceNumber": " sample2djj-6c394d0e-9802-49ae-bdd3-9ccaed431ecd ",
"success": "true",
"statusCode": 200,
"status": "SUCCESS"
}
}

For Linux-based environments, you can execute the runreport.sh shell script, by using an appropriate payload structure with the relevant response parameters, so as to call the report API with a unique access token to run or generate the report. A sample runreport.sh shell script file with a relevant payload structure and appropriate response parameters is provided as follows:

The following sample runreport.sh shell script comprises a basic payload structure with specific response parameters and the BASIC API Key authentication method has been applied in accordance with the specified payload structure. Based on the provided access token with the relevant set of response parameters, the report will run or get generated only after the successful generation of the specified access token. It is essential that the appropriate username and password credentials, which are used to access the Sigma Application, are specified properly in the runreport.sh shell script, as shown in the following code snippet:

username="terrim"
password="canvas"
resp=$(curl --location --request POST 'http://localhost:9081/sigma/rest/reports/generate-token' \
--header 'Content-Type: application/json' \
--header 'Cookie: JSESSIONID=66582CD7C3C1EEA0711D1DC7ECE8B5E3' \
--data-raw "{
   "action":"GENERATE_TOKEN",
   "authType":"BASIC",
   "username": $username,
   "password": $password
}")
echo $resp
responseType=$(echo $resp | jq -r '.headerMap.replyType')
atoken=$(echo $resp | jq -r '.headerMap.accessToken')
replyType="success"
if [ $replyType == $responseType ]
then
	curl --location --request POST 'http://localhost:9081/sigma/rest/reports/generate' \
	--header 'Content-Type: application/json' \
	--header 'Cookie: JSESSIONID=26233F01ED769AB1485D79AC3421F6C1' \
	--data-raw "{
		"action": "RUN_REPORT",
		"reportId": "7bd8091e-c2c3-47a7-a7d4-48ff477ddd28",
		"accessToken":$atoken
	 }"
else
 echo "The API Authorization failed so we cannot process the request. Kindly check the generate-token payload"
fi

  • No labels