Download API

This operation allows to generate and download a CSV file for a specified resource by performing the following POST request:

http://[hostName]:[portNumber]/[api-context-root]/generic/{resourceName}/download

Request

Method

POST

Path Parameters

resourceName - Name of the resource

Request Body

{
  "resource": {
    "_comment": "See Query API documentation for resource and more details."
  },
  "resourceRepresentation": {
    "_comment": "See Resource Representation documentation for more details."
  }
}

Details

This endpoint generates a CSV file that contains data filtered by the specified query parameters (q). The endpoint supports the following additional request parameters:

  • groupBy (optional): Groups the results by one or more attributes.

  • aggregate (optional): Specifies the aggregation operation to apply.

The service applies the requested filters and writes the resulting data set to the CSV file.

For information about the available resource attributes, see the HTTP API definition of the respective resource.

The following is mandatory to specify:

  • resourceRepresentation: fields - only the fields specified in the request body are included in the CSV file.

  • When list (array) attributes is request, each record is tilde (~) separated and fields of the record are number sign (#) separated.

When the request includes list (array) attributes, the CSV output uses the following delimiters:

  • The tilde (~) character separates individual records in the list.

  • The number sign (#) character separates fields within each record.

For example: record1Field1#record1Field2~record2Field1#record2Field2

Response

Success Response

HTTP/1.1 200 OK
Headers
Content-Type: text/csv
Content-Disposition: attachment; filename="<file-name>.csv"
Body
  • Streamed CSV content.

  • The client or browser writes the .csv file to the local system as the response data is received.

Authorization

The user with grant on GET access to HTTP API is for a resource can download data for that resource by using this endpoint.