REST API service

  • Updated

All data from Perfion can be queried via two different endpoints. The endpoints differ in their input methods. The response of both endpoints is the same.

The syntax of the JSON formatted response data is described in the Query Reference.

 

POST Data endpoint

This endpoint accepts a Perfion JSON query and queries the Perfion Database for data.

Url: POST /data

Parameters:

Parameter Description Properties
string query

JSON formatted search.

The Perfion Query JSON is separated into the sections: Select, From, Where, Having and Order.

The syntax is inspired by normal SQL and should therefore be easy to learn.

Content type: application/json

Parameter type: Body

As input, the method takes a Perfion Query in JSON format. The syntax is inspired by normal SQL but is enhanced with the ability to return multi-valued and sequenced data as well as localized data in multiple languages, and a number of other advanced abilities not possible with the regular SQL tabular result format.

The method returns all data in JSON format. For binary features such as images and files, the binaryID GUID value is returned. The actual Binary data can then be retrieved via the File & Image Server included in the Perfion API service.

Authentication:

The endpoint requires authentication. The token is a JWT bearer token. Please refer to Authentication to learn how to get a token.

The token must be supplied in the request header. In C# it can be done on a HttpClient like this:

The endpoint will respond with the following response codes

Response code 200 (OK)

The request was successful. The response body is a JSON object. Read more about the format in Query Reference. 

Response code 400 (Bad request)

Given parameters was missing or invalid. The response body contains is a JSON object formatted in one of the following ways:

Response code 401 (Unauthorized)

No valid authentication token was supplied!

Response code 500 (Internal server error)

Some unexpected error has occurred. The response body contains is a JSON object formatted as follows:

GET Data endpoint

This endpoint excepts an ID reference of a search feature item and executes the Perfion query that is saved on it.

Url: Get /data?searchId=123&index=0&maxCount=5 

Parameters:

Parameter Description Properties
int searchId Represents the identifier for a feature data item placed under a search feature. Parameter type: query
int index Optional parameter that injects page index into the saved Perfion query to give control of paging. Parameter type: query
int maxCount Optional parameter that injects page max count into the saved Perfion query to give control of paging. Parameter type: query

The method returns all data in JSON format. For binary features such as images and files, the binaryID GUID value is returned. The actual Binary data can then be retrieved via the File & Image Server included in the Perfion API service.

Authentication:

The endpoint requires authentication. The token is a JWT bearer token. Please refer to Authentication to learn how to get a token.

The token must be supplied in the request header. In C# it can be done on a HttpClient like this:

The endpoint will respond with the following response codes

Response code 200 (OK)

The request was successful. The response body contains is a JSON object formatted as follows.

Response code 400 (Bad request)

Given parameters was missing or invalid. The response body contains is a JSON object formatted in one of the following ways:

Response code 401 (Unauthorized)

No valid authentication token was supplied!                           

Response code 500 (Internal server error)

Some unexpected error has occurred. The response body contains is a JSON object formatted as follows:

POST Upload Binary endpoint

This endpoint uploads a binary file (e.g. an image or attachment) and assigns it directly to a binary feature on a specific item. Body must be 

Url: POST /binaries/{baseFeatureIdOrName}/{itemId}/{featureIdOrName}

Parameters:

Parameter Description Properties
string baseFeatureIdOrName The base feature the item belongs to, e.g. Product. Can be supplied as either the feature's ID or its name. Parameter type: URI
string itemId The ID of the item to upload the file to. Parameter type: URI
string featureIdOrName The binary feature to upload to, e.g. Image. Can be supplied as either the feature's ID or its name. Parameter type: URI
file The binary file being uploaded. The request body must contain exactly one part, with key file.

Content type: multipart/form-data

Parameter type: Body

Authentication:

The endpoint requires authentication. The token is a JWT bearer token. Please refer to Authentication to learn how to get a token.

The token must be supplied in the request header. In C# it can be done on a HttpClient like this:

In addition to a valid token, the authenticated user must have permission to both the specified item and the specified feature.

GET Audit Logs endpoint

The audit logs endpoint makes it possible to retrieve audit events recorded by the system within a specified date range.

Audit logs are retrieved using a request resembling:

http://ServiceHostName/audit-logs?from=2026-05-01&to=2026-05-12

The endpoint requires authentication and authorization before data is returned. If the request is not authenticated, the service may respond with 401 Unauthorized. If the request is authenticated but the caller does not have the required permissions, the service may respond with 403 Forbidden.

A required role must also be configured in the user interface before this endpoint responds successfully.

Parameters:

Para-meter Description Example
from The from parameter specifies the start date of the audit log interval. This parameter is required. http://ServiceHostName/audit-logs?from=2026-05-01&to=2026-05-12
to The to parameter specifies the end date of the audit log interval. This parameter is required. http://ServiceHostName/audit-logs?from=2026-05-01&to=2026-05-12

Response

A successful request returns audit log entries in JSON format:

[
  {
    "userId": "Admin",
    "timestampUtc": "2026-05-12T06:13:49.9733333+00:00",
    "event": "login",
    "interface": "PerfionApi",
    "source": "::1"
  }
]

The entries provided are as follow.

Entry Description
userId Specifies the user related to the recorded event. In some cases, this field may contain a descriptive message rather than a user identifier.
timestampUtc Specifies when the audit event occurred, expressed in UTC.
event Specifies the type of audit event that was recorded.
interface Specifies which interface the action originated from.
source Specifies the source of the recorded event.

Authorization

The endpoint requires the caller to be authenticated and to have the necessary role assigned. Without authentication the service may return 401. Without the required authorization or UI role configuration the service may return 403.

 

POST Get Version endpoint

This endpoint return the version number.

Url: GET /get-version

Parameters: no parameters needed

Authentication:

The endpoint requires authentication. The token is a JWT bearer token. Please refer to Authentication to learn how to get a token.

The token must be supplied in the request header. In C# it can be done on a HttpClient like this:

The endpoint will respond with the following response codes

Response code 200 (OK)

The request was successful. The response body is a JSON object.

{
  "Version": "5.2.0"
}

Response code 400 (Bad request)

Given parameters was missing or invalid.

Response code 401 (Unauthorized)

No valid authentication token was supplied!

Response code 500 (Internal server error)

Some unexpected error has occurred. The response body contains is a JSON object formatted as follows:

 

POST Execute Action endpoint

This endpoint execute an action and return an execution Id.

Url: POST /execute-action/{actionId}

Parameters:

Parameter Description Properties
int actionId Action Id to be executed

Content type: application/json

Parameter type: URI

string actionInput

JSON formatted table.

{
"ActionInput": {
"ActionTable1": [
{
"Col1": "123",
"Col2": "456"
},
{
"Col1": "123",
"Col3": "456"
}
],
"ActionTable2": {
"Col1": "123",
"Col2": "456"
}
}
}

Content type: application/json

Parameter type: Body

Authentication:

The endpoint requires authentication. The token is a JWT bearer token. Please refer to Authentication to learn how to get a token.

The token must be supplied in the request header. In C# it can be done on a HttpClient like this:

The endpoint will respond with the following response codes

Response code 200 (OK)

The request was successful. The response body is a JSON object.

{
"ExecutionQueueId": 19
}

Response code 400 (Bad request)

Given parameters was missing or invalid.

Response code 401 (Unauthorized)

No valid authentication token was supplied!

Response code 500 (Internal server error)

Some unexpected error has occurred. The response body contains is a JSON object formatted as follows:

POST Process report endpoint

This endpoint renders a Perfion report for a given set of items and returns the generated file (for example PDF, Excel, HTML or an image) as a binary download.

The endpoint is available in two versions. Version 2 takes all input in a single JSON request body. Version 1 takes most input as URL parameters. Both versions render the report the same way.

Tip: Use version 2 when you generate reports for many items. In version 1, item ids are sent in the URL, and a long list of ids can make the URL longer than the web server allows. The request then fails with an error like "The length of the query string for this request exceeds the configured maxQueryStringLength value." Version 2 sends the item ids in the request body, so there is no such limit on the number of ids.

Note: The unversioned URL POST /reports/{reportId}/process always uses version 1. To use version 2, call the versioned URL explicitly.

Version 2

Compared with the v1 endpoint, v2 replaces the mix of query-string parameters and a raw JSON array body with a single, strongly-typed JSON request body (ApiReport). It does not otherwise change how the report is rendered.

Endpoint

HTTP method POST
Route /v2/reports/{reportId}/process
Authentication Bearer JWT
Request content type application/json
Response content type Binary file - MIME type derived from the output file's extension

The unversioned route /reports/{reportId}/process always resolves to v1 (ReportProcess), never v2. You must call the versioned path explicitly:

POST /v2/reports/{reportId}/process

Path parameter

Name Type Description
reportId int Id of the report definition to render. If no report with this id exists, the request fails with 400 Bad Request.

Request body (ApiReport)

Serialized as camelCase JSON.

Field Type Required Description
ids int[] Yes Item ids the report is generated for.
language string No Data language of the report. If omitted, [DEFAULT LANGUAGE BEHAVIOR].
quality string No Image quality for rendered images (PDF output). One of: Low, Medium, High, Original, Custom. [BEHAVIOR ON INVALID VALUE].
saveFilename string No Overrides the output file's base name (without extension). Defaults to the report definition's own Name.
streamtype string (enum) No Output format. Defaults to Pdf. One of: Pdf, AddInOutput, Html, Mht, Rtf, Xls, Xlsx, Csv, Text, Word, Native, Jpeg, Png, MemoryBmp, Bmp (see ExportStreamingFormat).
parameters ApiReportParameters[] No Overrides for the report's query parameters (see below). May be omitted or null.

parameters[] - ApiReportParameters

Field Type Required Description
id string Yes Id of the report's query parameter to override. Matched case-insensitively against the report's own parameter ids; entries that don't match an existing parameter are silently ignored.
values string[] Yes Value(s) to assign to the matched parameter, replacing its current value(s).

Example request

POST /v2/reports/42/process
Authorization: Bearer <perfion-api-jwt>
Content-Type: application/json

{
  "ids": [101, 102, 103],
  "language": "EN",
  "streamtype": "Pdf",
  "quality": "High",
  "saveFilename": "ProductCatalog",
  "parameters": [
    { "id": "ShowPrices", "values": ["true"] }
  ]
}

Response

Success - 200 OK

The body is the raw bytes of the generated report file. Relevant headers:

Header Value
Content-Type MIME type resolved from the output file name's extension (MimeTypes.GetMimeTypeFromFileName)
Content-Disposition attachment; filename="<saveFilename or report name>.<ext>" — always an attachment, never inline
Access-Control-Expose-Headers Content-Disposition (so browser JS clients can read the file name cross-origin)

Errors

Failures are returned as RFC 7807 Problem Details (application/problem+json), produced centrally by the global ExceptionFilter / ProblemDetailsFactory — the controller itself has no explicit error handling.

Status Typical trigger Notes
400 Bad Request language longer than 7 characters; reportId does not exist; other argument/validation errors Report lookup failure throws PDeveloperException, mapped to 400.
401 Unauthorized Missing, expired, or invalid bearer token Enforced by [PerfionApiAuthentication] before the action runs.
404 Not Found Underlying resource lookup raises a not-found exception Less common than 400 for this endpoint; report-not-found currently surfaces as 400, not 404.
500 Internal Server Error Any unhandled/unexpected exception (e.g. report rendering failure) Catch-all mapping in ProblemDetailsFactory.CreateProblemDetail.

Version 1

Url: POST /v1/reports/{reportId}/process?id=3027&language=dan&streamtype=pdf

Parameters:

Parameter Description Properties
int reportId Report Id to be processed. Parameter type: URI
int id Id of item or items to be included in the report. Can be comma separated list of id’s if multiple items is to be included. Parameter type: URI
string language Language to generate report in. This is an optional parameter. Parameter type: URI
string streamtype

Report can be generated in the following formats:

  • Pdf
  • Html
  • Mht
  • Rtf
  • Xls
  • Xlsx
  • Csv
  • Text
  • AddInOutput

This is an optional parameter.

Parameter type: URI
string action The action parameter work for reports as described for Media Services URL Parameters. This is an optional parameter. Parameter type: URI
string parameters

JSON formatted array of report parameters as specified in the superquery of the report. This is an optional parameter.

[

{"id":'StringTestParam',"values":['Testing']},

{"id":'IntTestParam',"values":['123']},

{"id":'DateTestParam',"values":['2022-12-01']},

{"id":'SelectTestParam',"values":['3593']},

{"id":'MultiTestParam',"values":['1st value','2nd value']}

]

Content type: application/json

Parameter type: Body

Authentication:

The endpoint requires authentication. The token is a JWT bearer token. Please refer to Authentication to learn how to get a token.

The token must be supplied in the request header. In C# it can be done on a HttpClient like this:

The endpoint will respond with the following response codes

Response code 200 (OK)

The request was successful. The response body is a streamed report file.

Response code 400 (Bad request)

Given parameters was missing or invalid.

Response code 401 (Unauthorized)

No valid authentication token was supplied!

Response code 500 (Internal server error)

Some unexpected error has occurred.

 

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.