Product file restoration API
This page assumes you know how to authenticate your REST API requests
Restoration Principle
A product stored on REGARDS is either immediately downloadable, or stored on a nearline storage (like AWS Glacier), requiring a restoration action to become downloadable.
When a restoration is requested, there are several steps that are performed in the Catalog microservice:
- Products are retrieved from their URN through a request to ElasticSearch
- Products that are not accessible for the user are removed from the request
- The
Catalogmicroservice calls theStoragemicroservice through its REST Client.Storageis the microservice responsible for making products available.
This guide introduces 2 endpoints to make nearline products available, so their files can be downloaded synchronously :
- Check product availability endpoint returns the current status of the files, which indicates if they can be immediately downloaded
- Product restoration endpoint makes nearline product files available to download
User case example
Here is an example of product file you need to restore in order to be able to download it.
The product is not a reference (reference=false) and not online (online=false).
{
"id": "URN:FEATURE:DATA:tenant:50fe35a3-e085-3eb1-bb61-86ab3fdeb7dd:V3",
"providerId": "DATA-06-20220613-2390",
"entityType": "DATA",
...,
"files": {
"RAWDATA": [
{
"dataType": "RAWDATA",
"reference": false,
"uri": "https://regards.host.com/api/v1/rs-catalog/downloads/URN:FEATURE:DATA:tenant:50fe35a3-e085-3eb1-bb61-86ab3fdeb7dd:V3/files/BF39BC048B52618838529D9D98043190",
"mimeType": "application/xml",
"online": false,
"checksum": "BF39BC048B52618838529D9D98043190",
"digestAlgorithm": "MD5",
"filesize": 190,
"filename": "iso.xml",
"types": []
},
{
...
}
]
}
}
The value of the attribute id is a URN used by Check product availability and Product restoration endpoints
Check product availability endpoint
There is one endpoint for check availability of single product and another endpoint for check availability of multiple products. The following example shows a response of the multiple products endpoint.
This endpoint checks for every file of the input product(s) if the file is available.
Here is the response format, with an example.
{
"products": [
{
"files": [
{
"available": false,
"checksum": "BF39BC048B52618838529D9D98043190",
"expiration_date": "2020-12-31T00:00:00Z"
}
],
"id": "URN:FEATURE:DATA:tenant:50fe35a3-e085-3eb1-bb61-86ab3fdeb7dd:V3"
}
]
}
The attribute available value can be:
true- meaning the product file can be directly downloadedfalse- meaning the product file must be restored to be downloadable.
A file entry can have an expiration_date, meaning that the file will be not available after this date. It must
be restored again to be downloadable again.
An absent expiration date means that REGARDS does not know when the file will become unavailable.
If some product file is missing from the response, it means that you don't have access to the product file, or that such a product does not exist, or that an internal error occurred. In that case, you have to contact REGARDS administrators.
In order to avoid flooding the storage, checking availability is limited to a certain number by API call, configurable in catalog microservice configuration.
Product restoration endpoint
Endpoint usage
Make product files with available=false restored. It has is no effect on file stored in an online storage
or available=true.
There is one endpoint for single product restoration and
another endpoint for multiple product restorations.
These endpoints perform the action asynchronously, so they just return a code 200.
Once the restoration is done, a new call to the
endpoint Check product availability endpoint will now mark the file as
available (available=true)
By doing so, restoration ask storage microservice to make these files available.
After restoration, these files will be available for a configured time in hours.
Number of hours is configurable in catalog microservice.
After restoration, the product file will still be displayed in the catalog search as offline (online=false).
Logged user must have access right to this/these products
AMQP result
Once the file is restored, you can be notified about product restoration using an AMQP message
This message indicates if the restoration has been done successfully. If so, file is now available and ready to download.