How to backup content data using API
This document describes the steps to follow to backup content data from an environment using postman and APIs.
Prerequisites
Postman application.
How do I use Rest APIs? | Using Postman to access the REST APIs
Schema keynames
Login API
POST
/api/login
Example usage: https://sandbox5.orbita.cloud:8443/api/login
Header
Key | Value |
---|---|
Content-Type | application/json |
Body
raw > JSON
{
"username":"example@orbita.com",
"password":"Password@123"
}
Response Body
200 OK
{
"success": true,
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9"
}
Steps to follow
Log in to the environment using Login API
{{url}}/api/login
withMethod: POST
.Select body > raw > JSON and use the admin’s username and password in the request body.
Under the header tab, use the Key-Value pair
Content-Type: application/json
and click “Send”You will receive a
token
in the response body.Copy the token for later use. We recommend using the environment variables to store frequently used data.
Back up the Content data Using API
Patch
Example usage: https://sandbox5.orbita.cloud:8443/api/schema/content/facilitydata/data?limit=15&page=1&projectId=5cf9249637e124a03087780b
You can use the params such as document count (limit), page, and project ID.
Header
Key | Value |
---|---|
Content-Type | application/json |
Authorization | Bearer {{token}} |
Body
You can leave the Body with an empty payload {}
or with a query as shown below.
raw > JSON
or
Response Body
200 OK
Steps to follow
Use the Content search API along with the projected param with
Method: PATCH
{{url}}/api/schema/content/facilitydata/data?projectId=5cf9249637e124a03087780b
In the Header tab, use the following the Key-Value pairs
Content-Type: application/json
Authorization: Bearer {{token}}
Set the request body to raw > JSON > add the request query and click “Send”.
You will receive a response. Save the response body.
For each schema, the number of documents retrieved from the API should be split into smaller chunks.
You have to hit the API multiple times to get all the content data.