Update a node

Update a node

PUT api/nodes/hostname

Updates the details of an existing node.

When updating an IP address value, you must specify both the IP address and netmask value. If no netmask value is specified, a default value of /32 is used even if an existing netmask value exists.

Request syntax

put api/nodes/<hostname> '{"<parameter>": <value>, "properties": {"my_<property_name>": "<value>"}}'

Request parameters

The request accepts the following data in JSON format. All parameters are optional. Include only the parameters you want to change.

ParameterTypeDescriptionRequiredDefault value
node_nameStringThe name of the node.NoN/A
node_group_idIntegerThe ID of the node group to move the node to.NoN/A
store_numberIntegerThe store number to associate the node with. This corresponds to the Node Number value in SC//Reliantâ„¢ Platform Manager.NoN/A
instance_numberIntegerThe node instance number.NoN/A
serialnoStringThe serial number of the physical host of the node. The value is saved in lowercase.NoN/A
propertiesObjectA hash of dynamic properties to set on the node, keyed by property template name with the my_ prefix (for example, {"my_lan1_ip": "1.2.3.6"}). A property must exist in the node group's node properties for its value to be saved.NoN/A
puppet_masterlessBooleanWhether or not to run Puppet in masterless mode.Nofalse
puppet_environmentStringThe branch that is used for Puppet agent runs. If no value is specified, the default value of Production is used.Nonull

Response syntax

{
    "exporter_job": integer,
    "id": integer,
    "installation_token": {
        "uuid": "string",
        "state": "string",
        "expires_at": "timestamp"
    },
    "node_name": "string",
    "node_group_id": integer,
    "store_number": integer,
    "instance_number": integer,
    "hostname": "string",
    "serialno": "string",
    "virtual": boolean,
    "type_of_server": "string",
    "hierarchy_field_id": "string",
    "status": "string",
    "keepalive_timestamp": integer,
    "last_online": "string",
    "created_at": timestamp,
    "updated_at": timestamp,
    "virtual_nodes": [
    ],
    "puppet_masterless": boolean,
    "puppet_environment": "string",
    "properties": {
        "my_property1": "value1",
        "my_property2": {
            "nested_property1": "nested_value1"
        }
    },
    "service_checks": {
        "docker_versions": [
        ]
    },
    "available_docker_images": {
        "images": [
            {
            "ID": "string",
            "Tag": "string",
            "Size": "string",
            "Digest": "string",
            "CreatedAt": "string",
            "Containers": "string",
            "Repository": "string",
            "SharedSize": "string",
            "UniqueSize": "string",
            "VirtualSize": "string",
            "CreatedSince": "string"
            }
        ],
        "last_checked": timestamp
    }
}

Response parameters

If the action is successful, an HTTP 200 response is returned. The following data is returned in JSON format.

The API returns HTTP 200 even when a property value isn't saved, for example when the property doesn't exist in the node group's node properties. Check the properties and updated_at values in the response to confirm the change was made.

FieldTypeDescription
exporter_jobIntegerThe ID of the job that exports the node's updated configuration. Returned only when the update changes the node.
idIntegerThe ID of the node.
installation_tokenObjectThe details about the installation token.
node_nameStringThe name of the node. Returns null if no name is set.
node_group_idIntegerThe ID of the node group the node belongs to.
store_numberIntegerThe store number associated with the node. This corresponds to the Node Number value in SC//Reliant Platform Manager.
instance_numberIntegerThe instance number associated with the node.
hostnameStringThe hostname of the node.
serialnoStringThe serial number of the physical host of the node, in lowercase.
virtualBooleanWhether or not the node is a virtual node.
type_of_serverStringThe server type of the node. If no type is associated, this returns a null value.
hierarchy_field_idIntegerThe ID associated with the level of hierarchy field.
statusStringThe current status of the node.
keepalive_timestampIntegerThe UNIX epoch timestamp of the last keepalive transmission.
last_onlineStringThe timestamp of the last time the node was confirmed online, or unknown if the node has not checked in.
created_atTimestampThe timestamp indicating when the node was created in SC//Reliant Platform Manager.
updated_atTimestampThe timestamp indicating when the node was last updated in SC//Reliant Platform Manager.
virtual_nodesString arrayThe details of the virtual nodes associated with the node.
puppet_environmentStringThe branch that is used for Puppet agent runs. If no value is specified, the default value of Production is used.
puppet_masterlessBooleanWhether or not Puppet is run in masterless mode.
propertiesString arrayThe system and dynamic properties associated with the node.
service_checksString arrayThe details of the last service checks run on the node.
available_docker_imagesString arrayThe Docker images available on the node. This is similar to running a docker images command on the node.

Errors

The following are common errors returned by this API.

CodeMessageCause
404Not foundNo node exists with the specified hostname.
404NodeGroup not found!The node_group_id value doesn't match an existing node group.
422Validation Failed: node_group_id Invalid node group! Trying to assign a Virtual group to a Regular nodeThe specified node group is a virtual node group, and the node is a regular node.

Examples

Example 1: Update a system property on a node

This example updates the serialno system property value on node sit0000red1.

ruby api.rb <customer_code> put api/nodes/sit0000red1 '{"serialno": "s147EXAMPLE"}'

Response

{
    "exporter_job": 1544778,
    "id": 119996,
    "installation_token": {
        "uuid": "fb30d03e-4cd5-422a-8714-EXAMPLE",
        "state": "active",
        "expires_at": null
    },
    "node_name": "sit0000red1",
    "node_group_id": 0000,
    "store_number": 0000,
    "instance_number": 1,
    "hostname": "sit0000red1",
    "serialno": "s147EXAMPLE",
    "virtual": false,
    "type_of_server": null,
    "hierarchy_field_id": null,
    "status": "unknown",
    "keepalive_timestamp": 1726501979,
    "last_online": "unknown",
    "created_at": "2024-09-16T15:39:48.192Z",
    "updated_at": "2024-09-16T15:53:32.529Z",
    "virtual_nodes": [],
    "puppet_environment": null,
    "puppet_masterless": null,
    "service_checks": {
        "docker_versions": []
    },
    "available_docker_images": null
}

Example 2: Update a dynamic property on a node

This example updates the Lan 1 Ip dynamic property for node sit0000red1. When specifying an IP address you must also specify the netmask value as well, even if you aren't updating the existing netmask value. If no netmask value is specified, a default value of /32 is used.

Also note that when specifying a dynamic property value, you must add the my_ prefix, for example, the Lan 1 Ip property must be specified as my_lan1_ip when updating.

ruby api.rb <customer_code> put api/nodes/sit0000red1 '{"properties": {"my_lan1_ip": "1.2.3.6/32"}}'