This article describes how to use API to update Region for Titan Node

 

Prerequisite

  • Titan Node should be UP and running
  • Versa Director, VC configured as per the Titan requirements.
  • Install Postman
  • Import Versa Region Collection Update. postman_collection.json file in Postman app.

 

Note: NODE-IP is your Titan host IP.

 

Step 1:  Open Postman and Run API 1 to get access token first.

 

API 1: To Get Token: https://<NODE-IP>/oxauth/restv1/token

 

Authorization: Basic Auth

User Name: @!5FA2.4677.F41A.A083!0001!32DA.E028!0008!D9DB.3A0C.A48D.789B

Password: versa123

 

In Headers:

Content-Type: application/x-www-form-urlencoded

Authorization: Basic QCE2QjQwLjMxM0EuNDlFRi5BNjJGITAwMDEhNTg1Ni5BRTIwITAwMDghRTI3Qy5FOTgyLkM0QTQuNEZGQQo6c2NpbWNsaWVudA==

 

In Body:

grant_type=password

scope=openid+profile+email+uma_protection

username = versaappadmin@versa.com 

password= zaq!wsx        >>> Can retrieve from api.env file

 

 

Note: Copy access_token to update next API call to Update and Get API’s.

Step 2: Now copy the access_token to use below API to Post a new region collection update request: 

 

API 2: https://<<NODE-IP>>/api/v1/organizations/regions

 

Authorization:

Inherit auth from parent 

 

Headers:

Authorization: Bearer db29a117-2bdc-4cc3-87bc-58483761deba -> Output from Step1 Post call(access token)

Content-Type: application/json

 

Body: Payload to update Region 

[

   {

      "controllers":[

         {

             "IP":"10.192.234.27",                          >> Versa Controller1 IP

             "role":"primary",

             "name":"controller-1"

         },

         {

             "IP":"10.192.234.28",                         >> Versa Controller2 IP

             "role":"secondary",

             "name":"controller-2"

         },

         {

             "IP":"10.192.234.27",                          

             "role":"stagingPrimary",

             "name":"controller-1"

         },

         {

             "IP":"10.192.234.28",

             "role":"stagingSecondary",

             "name":"controller-2"

         }

      ],

      "directors":[

         {

            "IP":"10.192.234.21",                     >> Versa Director1 IP

             "role":"primary"

         },

         {

             "IP":"10.192.234.22",                     >> Versa Director2 IP

             "role":"secondary"

         },

         {

             "IP":"10.192.234.21",            

             "role":"stagingPrimary"

         },

         {

             "IP":"10.192.234.22",

             "role":"stagingSecondary"

         }

      ],

      "directorRoles":[

 

      ],

      "region":"East_Coast_01",                         >> Region Name

      "latitude":36.7783,

      "longitude":119.4179,

      "analytics":{

          "ClusterName":"titan-analytics",             >> Analytics ClusterName in VD

         "NorthboundIP":[

            {

                "IP":"10.192.234.23",                       >> >> Analytics IP

                "role":"searchNode"

            }

         ],

          "ConnectorPort":"8080"

      }

   }

]

 

 

 

 

  • First Change the Bearer token using Step 1 API, then send the request.

 

 

 

Once you copy the payload in body and send the request, it will give you 200 OK Response.

 

 Step 3: To verify Region updated or not 

 

API 3: To very Region: https://<<NODE-IP>>/api/v1/organizations/regions

 

Authorization:

Inherit auth from parent 

 

Headers:

Authorization: Bearer db29a117-2bdc-4cc3-87bc-58483761deba -> Output of the Step1 post call(access token)

 

 

  • First Change the Bearer token using Step 1 API, then send the request.