How can we help?

Searching:

0 results found

Reports/Post

POST /odata/Reports

Description

To create a new Axonize report.

See the following for request and response details ‒

See Also

Request ‒ Reports/Post

Property Type Description Mandatory
name String Free-text name of the Report. This will be used as the title of the report and can be used to get the report.
Type String/Enum May have the following value –

  • odata – OData query language is used to generate the report.
  • custom – Predefined reports provided by the custom report service. Contact Axonize customer support for a list of the available reports.
entity String The entity on which the action was performed (such as Device, Application or Product) –

  • Device
  • Product
  • Rules
  • Audit
  • Applications
  • AlarmInstances
  • Users
query String An expression in OData syntax that defines the data to be extracted from Axonize.

Example: ?$filter=contains(tolower(name),’gateway’).

columns Array Specifies a list of columns to be included in the Report.

Each column specified in this list must be the exact name of property of that entity. For example, serialNumber of a Device or the name of a Product.

The name of this property is used as the title of the column.

subscribers Array subscribers contains an array of subscribers. Each subscriber contains the following –

  • userId (String) – An array of user IDs.
  • cron – Specifies the schedule for sending this Report to the subscribed Users. This schedule is defined in Cron format, which is a standard for defining the timing and frequency of actions.
  • appId (String) – Application ID of the subscriber.
  • timezone – Timezone of the subscriber.
  • lastrundate (DateTime) – Last time the report was generated and sent.
  • filetype (String) – The current default is PDF. CSV and XLSX (Excel) are also supported.
  • lastresultcount (Integer) – The number of entities generated during the last run of the Report, such as Devices.
  • nextRunDate (DateTime) – The next time that the Report is scheduled to be generated and sent.

Note ‒ Users can also be scheduled to Reports in the Axonize Portal.

subscribers array

Filters String This is an optional field in which you can specify the filter to be applied to this report, which is used by the Axonize Portal when displaying the report. It is a JSON representation of the OData query string.

The OData query string will appear in the Filters tab of the report, as described on page 153. Specifying the string in this property enables you to edit this filter in the user interface and to immediately affect the report that is displayed.

For example: “filters”:”[{\”filter\”:\”createDate\”,\”msgKeyLabel\”:\”msg_create_date\”,\”msgKeyDisplayName\”:\”msg_by_create_date\”,\”type\”:\”Date\”,\”propName\”:\”createDate\”,\”operator\”:\”lessThan\”,\”filterValue\”:\”2018-02-12T12:20:42+02:00\”}]”

customProperties String Specifies the endpoint that is called in the custom report service. The custom report service consists of predefined SQL and API queries that are used to generate a custom report. Use this property when creating a custom report instead of filters.

The following properties are not relevant when using the customProperties property –

  • Entity
  • Query
  • Filters
  • Columns
customProperties/endpoint String The name of the endpoint that is contacted in the custom report service to generate a custom report.
createdByDisplayName String The name of the User who created the Report.
isDefault Boolean Specifies whether this report is included in the list of default reports provided by Axonize.
shared Array of Objects This object has two properties –

“shared”: {

“applications”: [],

“tenants”: [“580c7cfbcb597ad4e123456”]

  • applicationIds – Specifies the list of appIds to get access to this report. The Users of all these Applications are subscribed to this Report. appIds are returned in the response of Applications/Post.
  • tenantIds – Specifies the list of Tenant IDs to get access to this report. Users that have access to an Application that belongs to this Tenant are subscribed to this Report. Tenant IDs are returned in the response of the Tenant/Post.

 

Example JSON RepExample JSON Reports/Post Request

curl -X POST \

https://api.stg.axonize.com/odata/reports \

-H ‘Cache-Control: no-cache’ \

-H ‘Authorization: Token’ \

-H ‘Content-Type: application/json’ \

-H ‘appId: 801A048A-9F23-429F-BF0D-B6D35B212345’ \

-d ‘        {

“columns”:[“name”],

“entity”:”devices”,

“query”:””,

“name”:”devices – report”

}’

Response ‒ Reports/Post

All the same properties in the request are returned in the response. The response that is returned also contains the following properties –

Property Type Description
id String A unique Report identifier that is automatically generated for this Report by Axonize.
appId String A unique Application identifier that is automatically generated by Axonize. This is the identifier of the Application to which this Report is assigned.
createDate, createUser, updateDate,
updateUser
See Common Response Properties.

Example JSON Reports/Post Response

Status 201 – Created

{

“@odata.context”: “https://stg-axonizeapi-axonize.dev-ase-axonize.p.azurewebsites.net/odata/$metadata#Reports/$entity”,

“name”: “devices – report”,

“type”: “odata”,

“entity”: “devices”,

“query”: “”,

“columns”: [

“name”

],

“filters”: null,

“createdByDisplayName”: null,

“isDefault”: false,

“id”: “5b58670919ec0c1a68412345”,

“appId”: “801A048A-9F23-429F-BF0D-B6D35B212345”,

“createDate”: “2018-07-25T12:03:21.2135012Z”,

“createUser”: null,

“updateDate”: “0001-01-01T00:00:00Z”,

“updateUser”: null,

“reportInstances”: [],

“subscribers”: [],

“shared”: {

“applications”: [],

“tenants”: []

}

}