Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This document describes the steps to follow to backup content data from an environment using postman and APIs.

Prerequisites

  1. Postman application.

  2. https://orbita.atlassian.net/wiki/spaces/OCS/pages/7733431/How+do+I+use+Rest+APIs#Using-Postman-to-access-the-REST-APIs

  3. Schema keynames

Login API

Status
colourBlue
titlePOST

...

Code Block
{
    "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

Status
colourYellow
titlePatch

...

Code Block
{
    "result": [
        {
            "state": {
                "mode": "edit",
                "req": ""
            },
            "projectId": [
                "5cf9249637e124a03087780b"
            ],
            "itemName": "Hospital 2",
            "_id": "60a3ea26e393580082fa18f1",
            "hospitalname": "American Red Cross",
            "city": "Davenport",
            "location": {
                "lat": 25.978889,
                "lon": -80.282501
            },
            "createdAt": "2021-05-18T16:24:06.169Z",
            "createdBy": {
                "_id": "58c0587dc01db80f00191683",
                "firstName": "Orbita",
                "lastName": "Health",
                "locked": false,
                "inactive": false,
                "isLocked": false,
                "id": "58c0587dc01db80f00191683"
            },
            "user": "58c0587dc01db80f00191683",
            "modifiedAt": "2021-05-28T13:08:46.434Z",
            "__v": 0
        },
        {
            "state": {
                "mode": "edit",
                "req": ""
            },
            "projectId": [
                "5cf9249637e124a03087780b"
            ],
            "itemName": "Hospital1",
            "_id": "609e95d5e393580082fa128f",
            "hospitalname": "Children's Hospital",
            "city": "Davenport",
            "location": {
                "lat": 40.745255,
                "lon": -74.034775
            },
            "createdAt": "2021-05-14T15:23:01.113Z",
            "createdBy": {
                "_id": "58c0587dc01db80f00191683",
                "firstName": "Orbita",
                "lastName": "Health",
                "locked": false,
                "inactive": false,
                "isLocked": false,
                "id": "58c0587dc01db80f00191683"
            },
            "user": "58c0587dc01db80f00191683",
            "modifiedAt": "2021-05-18T16:22:32.730Z",
            "__v": 0
        }
    ],
    "paging": {
        "pageCount": 1,
        "currentPage": 1,
        "itemCount": 2,
        "resultsCount": 2,
        "hasMore": {
            "hasPrevious": false,
            "hasNext": false
        }
    }
}

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

Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@130ff
sortmodified
showSpacefalse
reversetrue
typepage
cqllabel in ( "api" , "content-data" ) and space = "OCS"
labelskb-how-to-article