Salesforce

Dynamic Reporting API

« Go Back
Article Content
Dynamic Reporting API
Generate VeraCore Dynamic Reports outside of the user interface. Recommended as a more efficient alternative to VeraCore's "Get" web methods.

In this article:
How it Works
About the API
Test the API in Swagger
Operations (with Examples)
Sequence of Operations

POST Login – Generate a Token
GET Reports – Get a List of Available Reports
GET Report Details - Get Columns/Filters for a Report
POST Report – Create a Task to Run the Report
GET Task Status – Check the Status of the Report Task
GET Report – Get the Report Results
GET Token Status – Check the Status of Your Token
Sequence of Operations - One Example

Recommended Reading

Generate a Dynamic Report without the VeraCore user interface. Use the Dynamic Reporting API to generate any Dynamic Report in your OMS, WMS, or PMA System.
Use it to send data to third party applications, your clients, or other vendors and partners.

How it Works

There is some preliminary setup before you can begin using the API. First, you'll need to define and publish the report in the VeraCore database.
Then, create a web service user in the PMA database.

Preliminary Steps

  1. Define and publish your Dynamic Report in the OMS, WMS, or in PMA system where the information resides.
  2. Create a Web Service user in PMA.

 

Once you have your report and your web service user:

  1. Run the POST Login operation to generate a token for the web service user. You'll use this token in all subsequent operations.
  2. (Optional) Run the GET Reports operation to get a list of Dynamic Reports available to that user.
  3. Select a Dynamic Report from the list. You'll need the reportName from the previous operation.
  4. (Optional) Run the GET Report Details operation to get the report parameters for your selected report.
  5. *Run the POST Reports operation to create the task of running the report. You'll need the report name and filter criteria from previous operations.
  6. *Run the GET Task Status operation to check on the status of the task of running the report. You'll need the TaskId from the previous operation response.
  7. *When your task status is "Done", run the GET Report Task operation to get the report. You'll need the TaskId from earlier.
  8. (Optional) Run the GET Token operation as needed to check your token status.


About the API
 

Content Type
application/json
Base URL
https://(YourDomain_or_RHU#)/veracore/public.api
 

Test the API in Swagger

VeraCore's Public API is documented in swagger. You'll be able to try the API and see fully formed json requests and responses there.

Test the API in swagger here:
https://(YourDomain_or_RHU#)/veracore/public.api/swagger/ui/index

You will need a Dynamic Report and Web Service User defined to test.

Operations

The seven operations are listed below.

Click the Description link to jump down to the details for each Operation in this article.
Below each Operation's detailed section, a sample request and response is provided.
Op
Description
Resource
Notes
POST
/api/login
Identifies the authorized user and assigns them a token. Displays the token and its expiration date.
GET
/api/reports
Identifies which reports the web service user is authorized to run.
GET
/api/reportdetail
Tells you which columns are on the report and what filters are available.
POST
/api/reports
Creates the task of running the report.
GET
/api/{TaskId}/status
Checks on the status of the report.
GET
/api/reports/{TaskId}
Gets the report results.
GET
/api/token
Checks the status of your current token.



Sequence of Operations

The operations you run will vary depending on whether you're planning a new report task or running a scheduled report. Though your own process can vary, here's an example of how this might look.

Set Up the Report

These might be run on demand.
Sequence
Operation
Remarks
1.
POST Login
Get your Token and its expiration date.
2.
GET Reports
Get a list of available report names.
3.
GET Report Details
Get the report info, columns, and filters for your selected report.



Generate the Report

These might be automated to run on schedule.
Sequence
Operation
Remarks
1.
GET Token
Check the status of your token prior to starting. If Token is valid, skip to Step #3. If token is expired, go to 2.
2.
POST Login
Get your Token. Then repeat Step 1.
3.
POST Report
Create the task of running the report using the report name and filter criteria from step 3 in the Setup process, above. The response is a Task Id, not the report itself.
4.
GET Task Status
Check the task status by Task Id. If the response is "Processing", wait and run this operation again. If the response is "Done", go to step 5. If the response is "Request Too Large", it means the report exceeds 100MB in size. Return to Step 3 with stricter filters to limit the data returned.
5.
GET Report

Get the report results by sending the Task ID for the now "Done" task of running the report. The response is the report itself.

 

Login

POST
Description
Login and Generate a Token.
URL
/api/login
Notes
This step creates a token for the Web Service User defined in PMA. Use the token created here in all subsequent operations. NOTE: Tokens expire after 3 months.
Parameters
Parameter
Parameter Type
Description
Data
Type
"username"
body
The web service user ID.
string
"password"
body
The web service password.
string
"systemId"
body
The six-character VeraCore OMS/WMS System ID against which you're running the report.
string
Response
Success Response
The response will be the token.
Other Responses
What it Means/How to Fix
Invalid UserID or Password!
Error: Check the user id and/or password in the Web service User setup.
Invalid system specified: {systemId value}
Error: Either this system doesn't exist, or the web service user id is not associated with it.

POST Login Examples

Request
Response
{
  "userName": "webuser",
  "password": "webpass",
  "systemId": "abcoms"
}
{
UtcExpirationDate": "2019-06-13T13:04:08.691857Z",
"Token": "abcdefghijklmnopqrst.abcdeFghiJKlmnopqrstuvw",
"Error": null
}

 

Get Available Reports

GET
Available Reports (back to Operations List)
Description
Get a list of available report names.
URL
/api/reports
Notes
This identifies which reports the web service user can run. Use the Report Name in the response in operations to get report details and to create the task of running the report.
Parameters
Parameter
Parameter Type
Description
Authorization
header
bearer {Token}
Response
Success Response
The response will be a list of available reports.
Other Responses
What it Means / How to Fix
 
 

 

Get Reports Examples

In the example below, we're sending our token to identify the user. The system returns the Dynamic Report names this user can access.

Note: Access to reports is determined by the Access Level of the web service user tied to the token (see the POST Login operation.) When you set up a web service user, you link them to an access level. When you publish the Dynamic Report in the VeraCore user interface, you restrict access by Access Level.

Request
Response
bearer abcdefghijklmnopqrst.
abcdeFghiJKlmnopqrstuvw
[
  {
    "id": 11,
    "name": "offers",
    "utcLastUpdated": "2018-09-25T15:44:25.617"
  },
  {
    "id": 4087,
    "name": "Order History",
    "utcLastUpdated": "2018-10-26T09:22:35.26"
  }
]

 

Get Report Details

GET
Report Details  (back to Operations List)
Description
Get Report Details for a Specific Report
URL
/api/reportdetail
Notes
This operation tells you which columns are on the report and what filters are available. You'll most likely use the filters in the response when setting up the task of running the report (see the Post Report operation, next.)
Parameters
Parameter
Parameter Type
Description
Data
Type
"reportName"
query
The reportName from the GET reports operation response.
string
Authorization
header
bearer {Token}
Response
Success Response
The response will show the report details with general report information first, followed by column definitions, followed by filters at the end.
Other Responses
What it Means / How to Fix
 
 

 

Get Report Details Examples

In the example below, we've asked for the report details for the "Order History" report from the previous response. The response here is the report info, a list of columns, and the filter criteria built into the report definition.
Request
Response
Request URL:
https://(YourDomainorRHU)/veracore/
Public.Api/api/reportdetail?reportName=Order%History

bearer abcdefghijklmnopqrst.
abcdeFghiJKlmnopqrstuvw
{
  "reportName": "Order History",
  "reportDescription": "Selects orders based on the order date and lists one line per offer ordered.",
  "lastModifiedUTCDate": "2018-10-26T09:22:35.26",
  "reportType": "Order Detail (Offers)",
  "listOfColumns": [
    {
      "columnName": "Order ID",
      "columnAlias": "Order ID"
    },
    {
      "columnName": "Purchase Order",
      "columnAlias": "Purchase Order"
    },
    {
      "columnName": "Order Date",
      "columnAlias": "Order Date"
    },
    {
      "columnName": "Order Release Date",
      "columnAlias": "Release Date"
    },
    {
      "columnName": "Ship To-Company",
      "columnAlias": "Ship To-Company"
    }
    {
      "columnName": "Offer Description",
      "columnAlias": "Description"
    }
  ],
  "filters": [
    {
      "filterColumnName": "Order Date",
      "type": "Date Range",
      "defaultValue": "30"
    },
    {
      "filterColumnName": "Ship To-Company",
      "type": "String",
      "defaultValue": "VeraCore"
    }
  ]
}

 

Start Running the Report

POST
Description
Start the task of running the report.
URL
/api/reports
Notes
This creates the new task of running the report. This step does not return report results. It sets up the job of running the report. Use the filters in the GET reportdetails operation to filter your data. The taskId that is the response will be used to check on the task later and to generate the report results.
Parameters
Parameter
Parameter
Type
Description
Data
Type
"reportName"
body
The name of the report as it appears in the GET reports operation response.
string
"filterCriteria"
body
(optional) Include applicable filters. Do not include if there are no data filters. Add as many filters as needed by repeating the filterColumnName and either filterValue or startDate/endDate parameters. (See example below.)
"filterColumnName"
body
If you're filtering records based on the value of a column (e.g., Order Date) include the column name as it appears in the GET reportdetails operation response.
string
"filterValue"
body
(optional) If the column you're filtering on is not a date field, enter the filter value here. The system will return records that match that value in the corresponding columnName.
string
 "startDate"
body
(optional) If the column you're filtering on is a date field, enter the value for the startDate.
string
 "endDate"
body
(optional) If the column you're filtering on is a date field, enter the value for the endDate.
string
Authorization
header
bearer {Token}
Response
Success Response
The response will be the taskId for the task you're creating to run the report. Use this in subsequent operations to check the task status and to get the report results.
Other Responses
What it Means/How to Fix
 
 

 

POST Reports Examples

In the example below, we're calling the Order History Report.

About Filters:
In our example, there are two filterCriteria parameters: Order Date falls between 1/1/2018-12/31/2018, and the Ship To Company is "VeraCore".
While you cannot add filters in the API request that don't already exist in the dynamic report, you can use a different filter value than the report's default value. For example, in the GET Report Details operation response (above), the filterColumnName "Order Date" has a default value of 30, meaning "the last 30 days of orders."
But our filter here can use a different value. Here, we are using the startDate and endDate to get a calendar year of orders. If we wanted the last 365 orders from today, we could have used "filterValue": "365".
Request
Response
bearer abcdefghijklmnopqrst.abcdeFghiJKlmnopqrstuvw

{
  "reportName": "Order History",
  "filterCriteria": [
    {
      "filterColumnName": "Order Date",
      "startDate": "01/01/2018",
      "endDate": "12/31/2018"
    },
    {
      "filterColumnName": "Ship To-Company",
      "filterValue": "VeraCore",
    }
  ]
}
"5138"
 

Get Task Status

GET
Description
Check the Status of the Task Running the Report
URL
/api/reports/{taskId}/status
Notes
This checks on the status of the report. Use the taskId returned in the POST reports operation, above.
Parameters
Parameter
Parameter
Type
Description
"TaskId"
path
The taskId for the task you created in the POST report operation, above.
Authorization
header
bearer {Token}
Response
Success Response
The response will be the status of the task. There are three possible statuses:
"Done" - The task is completed. You can generate the report.
"Processing" - The report is still running. Check back soon.
"Request too Large" - The request exceeds 100MB. Narrow your request with filters and create a new task.
Other Responses
What it Means / How to Fix
 
 

 

GET Task Status Examples

Request
Response
Request URL:
https://(YourDomainorRHU)/veracore/Public.Api/api/reports/5138/status

bearer abcdefghijklmnopqrst.abcdeFghiJKlmnopqrstuvw
"Done"
 

Get the Report

GET
Generate Your Report  (back to Operations List)
Description
Generate the Report You Ran
URL
/api/reports/{taskId}
Notes
This gets the report results. The response for this operation is the report.
Parameters
Parameter
Parameter Type
Description
"taskId"
path
The taskId for the Task you created in the POST report operation, above.
Authorization
header
bearer {Token}
Response
Success Response
The response will be the report itself.
Other Responses
What it Means / How to Fix
 
 

 

GET Report Examples

In this example, we're getting the results from task 5138, which is the report.
There were only four orders that met the criteria we used in our POST operation.
Request
Response
Request URL:
https://(YourDomainorRHU)/veracore
/Public.Api/api/reports/5138

bearer abcdefghijklmnopqrst.
abcdeFghiJKlmnopqrstuvw
{
  "ReportName": "Order History",
  "Filters": [
    {
      "HeaderName": "Order Date",
      "ColumnName": "Order Date",
      "FilterType": "Date Range",
      "Operation": "between",
      "FilterValue": null,
      "StartDate": "1/1/2018 12:00:00 AM",
      "EndDate": "12/31/2018 12:00:00 AM"
    },
    {
      "HeaderName": "Ship To-Company",
      "ColumnName": "Ship To-Company",
      "FilterType": "String",
      "Operation": "contains",
      "FilterValue": "VeraCore",
      "StartDate": null,
      "EndDate": null
    }
  ],
  "Data": [
    {
      "Order ID": "1330",
      "Purchase Order": null,
      "Order Date": "06/22/2018",
      "Release Date": null,
      "Ship To-Company": "Veracore",
      "Description": "$50 Gift Card"
    },
    {
      "Order ID": "1331",
      "Purchase Order": null,
      "Order Date": "07/10/2018",
      "Release Date": null,
      "Ship To-Company": "Veracore",
      "Description": "Regular Product"
    },
    {
      "Order ID": "1332",
      "Purchase Order": null,
      "Order Date": "07/10/2018",
      "Release Date": null,
      "Ship To-Company": "Veracore",
      "Description": "Regular Product"
    },
    {
      "Order ID": "1333",
      "Purchase Order": null,
      "Order Date": "07/10/2018",
      "Release Date": null,
      "Ship To-Company": "Veracore",
      "Description": "Regular Product"
    }
  ],
  "RowCount": 4,
  "TimeStamp": "2018-10-26T17:58:31.3982329Z"
}
 

Check the Token Status

GET
Description
Check if your Token is still valid.
URL
/api/token
Notes
This checks the current status of your token
Parameters
Parameter
Parameter
Type
Description
Authorization
header
bearer {Token}
Response
Success Response
The response will be the status of your token.
"Token is Valid"
Other Responses
What it Means / How to Fix
After parsing a value an unexpected character was encountered.
The string of characters is not a valid token.

 

GET Token Status Examples

We provide our token. A status is returned.
Request
Response
bearer abcdefghijklmnopqrst.abcdeFghiJKlmnopqrstuvw
"Token is Valid"
 

 

Recommended Reading

Dynamic Reporting
Create a Dynamic Report
Schedule Dynamic Reports to Run Automatically (Export Scheduler)
Generate a Dynamic Report
Customize the Layout of Dynamic Reporting Screens
Test Dynamic Reporting API
About this Article
Dynamic-Reporting-API
Dynamic Reporting API
Published
Erika Youmans
1/19/2024, 7:11 PM
Erika Youmans

Powered by