Exago Logo
Search
Generic filters
Exact matches only

REST – Sessions

Sessions are the means by which REST persists changes through multiple API calls. A REST session allows for you to easily encapsulate a group of user-specific changes. Most REST changes will only affect the current session, with folder changes being the exception. However, once an API session is committed and Exago is launched, a user will be able to make such changes as their role permits.

Note

All requests require a Session ID URL parameter and basic request headers. In the following document, headers are omitted in the interest of brevity.

Entering the API

A POST /Sessions call should always be the first made when entering the API. This creates a session, which contains a Session Id and an AppUrl.

Session Id

The Session Id is a GUID which uniquely identifies the instance of Exago you’re working in.

Example:

3c04c155-3317-4dab-a2ee-09572e3a8e44

This Id is passed as a URL parameter to all other method calls.

AppUrl

The AppUrl is a string which encodes the session information in a format readable by the host application.

Example:

ExagoHome.aspx?d=fk7hInneiNI7yUR1n8fCjjbTuIdTWgQrj8AaUlzO8l7K5JMaf7DhbZxzaSAXthP3bWLA%2fzG4AtXApO6pGoBpzQ%3d%3d&showerrordetail=true

The AppUrl consists of three components: the Home Page, an alphanumeric string, and the ShowErrorDetail URL parameter.

Once you have committed your API changes and want to launch Exago, append the AppUrl to the end of your Exago base URL and launch the full URL string in a browser:

http://yoursite.com/exago/ExagoHome.aspx?d=fk7hInneiNI7yUR1n8fCjjbTuIdTWgQrj8AaUlzO8l7K5JMaf7DhbZxzaSAXthP3bWLA%2fzG4AtXApO6pGoBpzQ%3d%3d&showerrordetail=true

An AppUrl can only be used once. Launching an API session will permanently close it, and apply your custom variables into a new user session in the host application.

Tip

Retrieving the AppUrl via GET /Sessions/{Id} should always be the last call made when finishing in the API if you didn’t store it after the initial POST /Sessions call.

Session JSON

The Sessions endpoint allows for creation and deletion of sessions and access to some general settings. It also allows you to specify and configure the action that the session will take when launched. To launch a report in the full user interface, it needs to be set in Sessions as the output report.

Sessions are represented as JSON objects with the following properties:

NameTypeWritableDescription
IdstringnoThe unique Id of this session (“sid”)
AppUrlstringnoThe AppUrl of this session; changes to reflect any modifications made to this session in the API
Pagestringyes (“ExagoHome”)The Exago home page
ApiActionenumyes (“Default”)Api Action, to take when this session is launched
ExportTypeenumyesExport Type, if ApiAction is ‘ExecuteReport’
ShowTabsbooleanyes (true)Whether the tab bar should be shown
ShowErrorDetailbooleanyes (true)Whether detailed error messages should be shown
ReportSettingsReportyesA report with optional sorts & filters if ApiAction is ‘ExecuteReport’ or ‘EditReport’
ApiKeystringnoUsed when instantiating the JavaScript Api, if applicable.

Example:

{
  "AppUrl": "ExagoHome.aspx?d={alphanumeric}&showerrordetail=true",
  "Id":              "{sid}"
  "Page":            "ExagoHome",
  "ApiAction":       "ExecuteReport",
  "ExportType":      "Html",
  "ShowTabs":        true,
  "ShowErrorDetail": true,
  ...
}

Report JSON

If you want to edit or launch a report, specify a report in the ReportSettings property. Reports are represented as JSON objects with the following properties:

NameTypeWritableDescription
Idstringyes (v2021.1+)
no (pre-v2021.1)
The unique ID of the this report
Can be used to retrieve a report from the Storage Management database in lieu of the ReportPath property below in v2021.1+
ReportPathstringyesFull path from root folder to this report
SortsResourceSortsyesAny sorts to apply to this report
FilterItemsarray of FilteryesAny filters to apply to this report
IsErrorbooleannoWhether there were any validation errors when loading this report
ErrorListarray of ReportValidationErrorTypenoIf IsError == true, a list of errors encountered when loading this report. Possible Errors

Example:

"ReportSettings": {
  "Id": "ad0f442e-275b-48a0-893f-0b1255ee7880",
  "ReportPath": "ReportsProduct Sales Report",
  "SortsResource": null,
  "FilterItems": [],
  "IsError": false,
  "ErrorList": null
}

Note

Windows file paths are delineated by double-backslashes:

Sorts

Sorts can be added to the report, either in addition to, or replacing its existing sorts. This only affects the current session, and does not edit the base report. The collection of sorts to be added is represented as a JSON object with the following properties:

NameTypeWritableDescription
ReplaceFlagstringyes (false)Whether to replace all existing report sorts
SortItemsarray of SortyesList of sorts to apply to this report

Example:

{
  "ReplaceFlag": false,
  "SortItems": [
    {
      "Id":  "Products.ProductName",
      "Asc": false
    },
    {
      "Id":  "Categories.CategoryName",
      "Asc": false
    }
    ...
  ]
}

Sort

Each sort in the SortItems property is represented as a JSON object with the following properties:

NameTypeWritableDescription
IdstringrequiredData field to sort on;
format: “EntityName.ColumnName”
Ascbooleanyes (false)Whether sort direction is ascending

Example:

{
  "Id":  "Products.ProductName",
  "Asc": false
}

Filter

Filters can be added to the report in addition to its existing filters. This only affects the current session, and does not edit the base report. Each filter to be added is represented as a JSON object with the following properties:

NameTypeWritableDescription
NamestringrequiredData field to filter on;
format: “EntityName.ColumnName”
EntityNamestringyesEntity name to filter on (deprecated)
ColumnNamestringyesColumn name to filter on (deprecated)
DataTypeenumyes (“string”)Data Field Type
Operatorenumyes (“EqualTo”)Filter Operator Type
Valuesarray of stringsyesValues to filter with
AndFlagbooleanyes (true)Whether this filter should be AND-ed with the next (versus OR-ed)
Promptbooleanyes (false)Whether this filter should prompt the user for a value (Advanced or Express Reports)
GroupWithNextbooleanyes (false)Whether this filter should be grouped with the next (Advanced or Express Reports)

Note

Filter values that are DateTime strings must be able to be parsed by the .NET method DateTime.Parse using the current thread culture.

Example:

{
  "Name": "Categories.CategoryName",
  "DataType": "string",
  "Operator": "OneOf",
  "Values": [
    "Beverages", "Seafood", "Produce"
  ],
  "AndFlag": true,
  "Prompt": false,
  "GroupWithNext": false
}

Create a Session

POST /rest/Sessions

Available parameters

NameTypeDescription
configstringSpecify which config file to create the session with.

 

Format: CustomConfigFile

Using curl

curl http://{webservice}/rest/Sessions -X POST ^
	-d "{'Page':'Reporting','ApiAction':'Home','ShowTabs':false}"

Example response

Status: 201 Created
Location: /{webservice}/rest/Sessions/{sid}

{
  "AppUrl": "Reporting.aspx?d={alphanumeric}",
  "Id":              "{sid}",
  "Page":            "Reporting",
  "ApiAction":       "Home",
  "ExportType":      null,
  "ShowTabs":        false,
  "ShowErrorDetail": true,
  "ReportSettings": {
    "ReportPath": null,
    "SortsResource": null,
    "FilterItems": null
  }
}

Caution

Currently, if a new XML configuration file and temp path are passed via a POST session, the API session .enc file will first be written to the original temp path of the default config file rather than the newly assigned path. This limitation prevents this action from being properly completed. However, a new XML configuration file may still be passed with the default temp path, allowing this limitation to be bypassed.

Show a Session

GET /rest/Sessions/{sid}

If the session is launched, the session object is deleted and can no longer be viewed.

Note

Unlike other resources, the {sid} is passed as part of the endpoint string, not as a URL parameter.

Using curl

curl http://{webservice}/rest/Sessions/{sid} -X GET

Example response

Status: 200 OK

{
  "AppUrl": "Reporting.aspx?d={alphanumeric}",
  "Id":   "{sid}",
  "Page": "Reporting",
  ...
}

Edit a Session

PATCH /rest/Sessions/{sid}

Only supply the properties to be edited. If the session is launched, the session object is deleted and it can no longer be edited.

Note

Unlike other resources, the {sid} is passed as part of the endpoint string, not as a URL parameter.

Using curl

curl http://{webservice}/rest/Sessions/{sid} -X PATCH ^
	-d "{'Page':'CompanyHome'}"

Example response

Status: 200 OK

{
  "AppUrl": "Reporting.aspx?d={alphanumeric}",
  "Id":   "{sid}",
  "Page": "CompanyHome",
  ...
}

Delete a Session

DELETE /rest/Sessions/{sid}

If a session is deleted, the AppUrl can no longer be used. If the session is launched, the session object is deleted and it can no longer be edited.

Note

Unlike other resources, the {sid} is passed as part of the endpoint string, not as a URL parameter.

Using curl

curl http://{webservice}/rest/Sessions/{sid} -X DELETE

Example response

Status: 204 No Content

Launch a Report with Sorts and Filters

POST /rest/Sessions

Set the ApiAction to ExecuteReport, and specify a report, with any optional sorts and filters, in the ReportSettings property. If you want to save the report to a file, set the ExportType to the desired file type.

Using curl

curl http://{webservice}/rest/Sessions -X POST ^
	-d @sessionSettings.txt

sessionSettings.txt

"{'ApiAction':'ExecuteReport','ExportType':'html','ReportSettings':{'ReportPath':'SalesProducts','FilterItems':[{'Name':'Categories.CategoryID','DataType':'Integer','Values':["123"]}],'SortsResource':{'ReplaceFlag':true,'SortItems':[{'Id':'Categories.CategoryID','Asc':true}]}}}"

Response

Status: 201 Created
Location: /{webservice}/rest/Sessions/{sid}

{
  ...
  "ApiAction":       "ExecuteReport",
  "ExportType":      "Html",
  ...
  "ReportSettings": {
    ...
    "ReportPath": "SalesProducts",
    "SortsResource": {
      "ReplaceFlag": true,
      "SortItems": [
        {
          "Id": "Categories.CategoryID",
          "Asc": true
        }
      ]
    },
    "FilterItems": [
      {
        "Name": "Categories.CategoryID",
        "DataType": "Integer",
        "Values": ["123"]
      }
    ]
  }
}

To launch the report in Exago, take the AppUrl, and append it to the URL to your Exago installation to create the full URI path:

http://{website}/{exago}/{AppUrl}

Example

http://yoursite.com/reporting/homepage?d={alphanumeric}&showerrordetail=true
Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Table of Contents