Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

For background on the context of this article, please be sure you're familiar with the content of Flex5 REST API - Getting Started Guide. This article is a short walkthrough on how to use the /api/report interface from your application. It assumes that you have the necessary knowledge to write such an application and to access a 3rd-party's API.

Basic Request Format

As mentioned in the Getting Started wiki, you will need an authorization token for your Request Header. For the remainder of your request, you have a couple of options. You can follow a syntax similar to that used in Flex4 XML-based data producer report development and put your query parameters in the URL, or you can put them in the Request Body.

URL-based Parameters

If you opt for using the URL method, the XML-based data producer URL looks like this:

...

where api-path includes any necessary additions such as inventory-tree/nodes, where path-variable(s) includes things like modelId or documentId, and where param-id1 and param-id-2 are parameter ids as found in report-definitions.json. The parameter count can, of course, vary. In any case, if you're using a report that requires one or more parameters, your first parameter must be parameterSubmission with a value of true. If this is not included, we cannot guarantee your results

Path and Path Variable

For the Report API, the path is simply /f5/api/report and the only path variable you need is the reportId as specified in the id property of the report-definitions.json

Request Body Parameters

If you choose to utilize the Request Body for sending parameters, simply organize the parameters and their values according to the specification you're using. For example, if you use Swagger UI to test this endpoint, you will get a request in CURL like: 

...

Code Block
curl -X GET \
  'https://flex5dev.flexrentalsolutions.com:8443/f5/api/report/process/deposit_invoice?PROJECT_ELEMENT_ID=5d03ea40-2334-11e9-bddb-080027bee86d' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Postman-Token: 0f46fef1-d2dc-4572-8429-5672c279de64' \
  -H 'X-Auth-Token: eyJhbGciOiJIUzUxMiIsInppcCI6IkdaSVAifQ.H4sIAAAAAAAAAOVWTY_TMBD9LzlX1n4VLb0hceGA2AtcEAfXnk1n17HDjJPSRfx3Jtm2camTBnHkUEV1xm-e35sZ52fBzbpYFaS93RWLwhDoCLZYXS-Xy6vr-
_u72-XN20URwWsfP9hDqIVWomugCpkxeC5WX_u_qqbwBCayahG2-xj1iLLdoHasCIx25mSzQt-Cj4F26ab9OxMIVMNA72yF_gBo5Fdpr0sYQ0pSpky6jRYcxMNGtcaXULPwRoO-
zDAYMOFHHSgCnb7v1rTrH4J7QvMohg3GN9UaSIUWiNBCRprcgUzFIoEX_eMXYfZn7oFbpdH3Lpkc9NSpxhgclMFK1jgVUCdnPIcLZEDxplNl3J5JD8BiTPMxeMaILYzVh9loX8KDZt4GspnzZxHSAF2WBKWOApnDf3XgYy9P3n6nd6
E5cT9jUcbfDp53nEp6kMOQUJZuyUtxoVqmuMoKB68dvqQH7vFHBK6CbRycYqbypY4di16YPGJ5tpzEnklkQuPPGmx4XVJo6guNz0aPOrCmsGVQG7QWRoNei0l9b2TiidTH0s8MK4qNyNllFGMIB6v2Dg5uMWgyGxXDsyzl-
2wsOK3YYaCk_TPNTDs3Yk3_cGiiTGUOTibTvLMKohovc22t8hnKUsngraYL_mUySWNN95TaaoJNkGuiS1fVkbM1vEYHD-g_1V3VH806j3kPLQ5jtGsLGSvPty5sRahKJrgCGbeO_6K50iS6iRuhL60tV-1nHhrqnwthvsEzbRkTZY6
us4Wbd3dMDPr_R7dvi0I-QvafZ29uru5uf_0GTjUvXsMJAAA.77GfbKRnAQ59-Vd4Y7FxSi0f95jt8TC7PTh5ZoPCQGzX4uzclufoA9KiPBeDhak6hb08I5ASsVacTFfcNJghrA \
  -H 'accept: */*' \
  -H 'cache-control: no-cache'


Report Types

Flex has 3 types of reports: Global, Definition, and Instance. For a detailed explanation of these, please see our Help Center article, Global, Definition, and Instance Level Reports. What's the difference? Currently, the Flex5 API only supports Instance Level reports. The default file type is PDF, however, with the addition of the REPORT_FORMAT parameter and appropriate value, you can get other types. As of this writing, the only tested values are pdf and csv.

Additional functionality will be added in the future.


Response

As of this writing, all responses are returned as a base64-encoded String. If necessary, your app will need to handle the decoding of that String for whatever its intended use. After decoding, you should be able to download and open the file.