Configuring the server name by using REST Administration APIs

System administrators can set and view the configured name of a server by using REST Administration APIs.

About this task

You can configure a server name by using a REST Administration API, or by using the IBM® Watson IoT Platform - Message Gateway Web UI. For more information about using the IBM Watson IoT Platform - Message Gateway Web UI to configure a server name, see Configuring the server name by using the IBM Watson IoT Platform - Message Gateway Web UI.

If the IBM Watson IoT Platform - Message Gateway server is an active cluster member, do not change ServerName.

Procedure

  • To set the server name, use the IBM Watson IoT Platform - Message Gateway REST API POST method.
    1. Use the following IBM Watson IoT Platform - Message Gateway configuration URI:

      http://<admin-endpoint-IP:Port>/ima/configuration

    2. Provide ServerName object configuration data in the payload of the POST method by using the following schema. Content-type is set to application/json.
      
      {    
        "ServerName": "string",
        "Version": "v1"
      }
      Where:
      • ServerName
        Specifies the server name.
        The maximum length of the name is 64 characters.
        Names can contain characters in the ranges a-z, A-Z, 0-9 and the special character - only.
        The default value of ServerName is a string that has the following format: <server_node_name>:<admin-endpoint-port>. This default value does not change when the admin-endpoint port is changed.
  • To view the server name, use the IBM Watson IoT Platform - Message Gateway REST API GET method with the following IBM Watson IoT Platform - Message Gateway configuration URI:

    http://<admin-endpoint-IP:Port>/ima/configuration/ServerName

Example

The following example shows a POST method to set the server name to "myServer.TestSystem" by using cURL:


curl -X POST \
   -H  'Content-Type: application/json'  \
   -d  '{                       
           "ServerName":"myServer.TestSystem:9089"
        }
       '   \
http://127.0.0.1:9089/ima/v1/configuration/

The following example shows an example response to the POST method:


{        
  "Version": "v1",
  "Code": "CWLNA6011",
  "Message": "The requested configuration change has completed successfully."
}

The following example shows a GET method to view the server name by using cURL:


curl -X GET http://127.0.0.1:9089/ima/v1/configuration/ServerName

The following example shows an example response to the GET method:


{
  "ServerName": "myServer.TestSystem:9089",
  "Version": "v1"
}

The following example shows a POST method to set the server name to the default value by using cURL:


curl -X POST \
   -H  'Content-Type: application/json'  \
   -d  '{                       
           "ServerName": null
        }
       '   \
http://127.0.0.1:9089/ima/v1/configuration/

The following example shows an example response to the GET method:


{
  "ServerName": "ServerA.mycompany.com:9089",
  "Version": "v1"
}