To download a partner report you will first need to order the report:
POST https://api.enin.ai/analysis/v1/app-customer/$APP_CUSTOMER_UUID/partner-report-order-composite
{"partner_report_composites":[{"partner_report":{"company_uuid":"$COMPANY_UUID","partner_report_type_key":"$PARTNER_REPORT_TYPE_KEY"}}]}
The PARTNER_REPORT_TYPE_KEY can be one of the following:
From the response you will get a partner_report_order_uuid
. Use this to check on the status of the report you requested.
GET https://api.enin.ai/analysis/v1/app-customer/$APP_CUSTOMER_UUID/partner-report-order/$PARTNER_REPORT_ORDER_UUID
From the response you know that the report is ready when partner_report_order_status_key
is set to "complete"
.
Next, you will have to check the metadata about the report:
GET https://api.enin.ai/analysis/v1/app-customer/$APP_CUSTOMER_UUID/partner-report-composite?company_identifier=$COMPANY_UUID&partner_report_type_identifiers=$PARTNER_REPORT_TYPE_KEY&partner_report_order_uuid=$PARTNER_REPORT_ORDER_UUID
In there you will find a path like this:
GET
https://api.enin.ai/analysis/v1/file/app_customer/$APP_CUSTOMER_UUID/company/$COMPANY_UUID/$PARTNER_REPORT_TYPE_KEY/NO-917540640-brreg-company-certificate-20230707T093632.pdf
The file can then be downloaded here:
GET app_customer/$APP_CUSTOMER_UUID/company/$COMPANY_UUID/$PARTNER_REPORT_TYPE_KEY/NO-917540640-brreg-company-certificate-20230707T093632.pdf
But before you can download the file, you will need to authenticate.
There are two ways to authenticate while downloading the file. You can directly authenticate with basic authentication or token authentication as normal. However, this is not always possible from a web application because a lot of browsers do not support downloading files using special auth HTTP headers injected by JavaScript. Because of this we also support file sessions.
Simply use the Authorization
header as described here.
Construct a list of object with paths to reports you want to open up:
POST https://api.enin.ai/analysis/v1/file-session
[{"app_customer_uuid":"$APP_CUSTOMER_UUID","file_path":"app_customer/$APP_CUSTOMER_UUID/company/$COMPANY_UUID/brreg_company_certificate/NO-917540640-brreg-company-certificate-20230707T093632.pdf"}]
In response you will get the same list, but with a new file_session_uuid
field:
[
{
"app_customer_uuid": "$APP_CUSTOMER_UUID",
"file_path": "app_customer/$APP_CUSTOMER_UUID/company/$COMPANY_UUID/brreg_company_certificate/NO-917540640-brreg-company-certificate-20230707T093632.pdf",
"file_session_uuid": "$FILE_SESSION_UUID"
}
]
Use this session UUID to construct a download link:
GET
https://api.enin.ai/analysis/v1/file/app_customer/$APP_CUSTOMER_UUID/company/$COMPANY_UUID/brreg_company_certificate/NO-917540640-brreg-company-certificate-20230707T093632.pdf?file_session_uuid=$FILE_SESSION_UUID&bucket_name=general
This link will be supported by any browser. The report file will continue to exist on our file system, but the file session will expire after a day, and you will need to generate a new file session to download it again.