API Gateway 11.1 | Administering API Gateway | Operating API Gateway | Data Management | Data Housekeeping | Restoring Archived Data using API
 
Restoring Archived Data using API
Restoring is the process of copying backed up data from an archive and restoring it in the database to replace lost or damaged data. You can restore the archived data in the API Gateway database as required.
You can use the REST API, apitransactions/archives to restore archived data.
View the list of available archive files using the following REST API:
curl -XGET
"http://apigw_host:agigw_port/rest/apigateway/apitransactions/archives"
-H 'accept:application/json' -H "Accept: application/json" -u username:password
In this REST API, replace apigw_host and agigw_port with the hostname and port number of your API Gateway instance.
Sample response
{"archiveFiles":["default-2021-10-13-1634096748481","default-2021-10-13-1634096810028",
"default-2021-10-13-1634096871380","default-2021-10-13-1634096933197",
"default-2021-10-13-1634097054614","default-2021-10-13-1634097248461"]}
Restore the required archive file using the following REST API:
curl -XPOST
"http://apigw_host:agigw_port/rest/apigateway/apitransactions/archives/filename"
-H "accept:application/json" -u username:password
Sample command
curl -XPOST
"http://apigw_host:agigw_port/rest/apigateway/apitransactions/archives/default-2017-02-09-1486644396751"
-H "accept:application/json" -u Administrator:manage
Sample response
{
"jobId": "6d1f65f0-3ec2-4545-bd29-971be1471099"
}
Monitor restore status
You can monitor the status of a restore job using the following API:
curl -X GET -H "content-type:application/json" -H "Accept:application/json"
"http://apigw_host:agigw_port/rest/apigateway/apitransactions/jobs/job_id"
In this REST API, replace apigw_host and agigw_port with the hostname and port number of your API Gateway instance.
If the restore is successful, you get the following output.
{
"status": "Completed",
"action": "restore",
"jobId": "6d1f65f0-3ec2-4545-bd29-971be1471099",
"creationDate": "2024-06-03 19:31:55 GMT",
"Filename": "default-2024-06-03-1717440636921"
}
If the restore job fails, the status field in the above output displays Failed. You can look into server logs located at /opt/softwareag/IntegrationServer/logs/server.log and analyze the failure reasons.