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

  1. Postman application.

  2. How do I use Rest APIs? | Using Postman to access the REST APIs

  3. Schema keynames

Login API

POST

/api/login

Example usage: https://sandbox5.orbita.cloud:8443/api/login

Header

Key

Value

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

  1. Log in to the environment using Login API {{url}}/api/login with Method: POST.

  2. Select body > raw > JSON and use the admin’s username and password in the request body.

     

  3. Under the header tab, use the Key-Value pair Content-Type: application/json and click “Send

     

  4. You will receive a token in the response body.

     

  5. 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

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

  1. Use the Content search API along with the projected param with Method: PATCH {{url}}/api/schema/content/facilitydata/data?projectId=5cf9249637e124a03087780b

  2. In the Header tab, use the following the Key-Value pairs

    1. Content-Type: application/json

    2. Authorization: Bearer {{token}}

       

  3. Set the request body to raw > JSON > add the request query and click “Send”.

     

  4. 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.

Related Articles