Create a node

Create a node

POST api/nodes

Creates a new node in an existing node group.

Request syntax

post api/nodes '{"node_group_id": <integer>, "instance_number": <integer>, "store_number": <integer>, "properties": {"<my_property_name>": ["<value1>", "<value2>", "<value3>"], "<my_property_name>": "<value1>"}}'

Request parameters

The request accepts the following data in JSON format.

ParameterTypeDescriptionRequiredDefault value
node_group_idIntegerThe ID of the node group to associate the node to.YesN/A
instance_numberIntegerThe node instance number.YesN/A
store_numberIntegerThe store number to associate the node with.YesN/A
node_nameStringThe name for the node.Nonull
serialnoStringThe serial number of the physical host of the node. The value is saved in lowercase.Nonull
parent_nodeStringThe hostname of the parent node. If specified, the node is created as a virtual node.Nonull
propertiesObjectA hash of dynamic properties to set on the node, keyed by property template name with the my_ prefix (for example, {"my_lan1": "1.2.3.4"}). A property must exist in the node group's node properties for its value to be added to the node. When specifying an IP address property with a netmask property, the IP address property must be specified first in the request. See Example 2.NoN/A
puppet_masterlessBooleanIndicates if the node is a masterless puppet node.Nofalse
puppet_environmentStringThe puppet environment for the node.Nonull

Response syntax

{
    "exporter_job": integer,
    "id": integer,
    "installation_token": {
        "uuid": "d3cceEXAMPLE",
        "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": {
        "property1": "value1",
        "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 201 response is returned. The following data is returned in JSON format.

FieldTypeDescription
exporter_jobIntegerThe ID of the job that exports the new node's configuration.
idIntegerThe ID of the node.
installation_tokenObjectThe details about the installation token.
node_nameStringThe name of the node. Returns null if no name was specified.
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. The hostname is generated in the form <customer_code><store_number>red<instance_number>.
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
422Validation Failed: instance_number is missing, store_number is missingOne or more required parameters are missing from the request. The message lists each missing parameter.
422Validation Failed: store_number Hostname already taken, check other nodes with same instance and node number.A node with the same store number and instance number already exists.

Examples

Example 1: Create a new node

This example creates a new node in node group ID 2235 and specifies a value of 1.2.3.4 for the lan1 dynamic property on the node. The dynamic property must exist at the node group level for the value to be added to the node. The node will have hostname in the form of <customer_code><store_number>red<instance_number>.

ruby api.rb <customer_code> post api/nodes '{"node_group_id": 2235, "instance_number": 0, "store_number": 2235, "properties": {"my_lan1": "1.2.3.4"}}'

Response

{
  "exporter_job": 1544847,
  "id": 120002,
  "installation_token": {
    "uuid": "2ad2580a-1475-4567-a6f2-EXAMPLE",
    "state": "active",
    "expires_at": null
  },
  "node_name": null,
  "node_group_id": 2235,
  "store_number": 2235,
  "instance_number": 0,
  "hostname": "sit2235red0",
  "serialno": null,
  "virtual": false,
  "type_of_server": null,
  "hierarchy_field_id": null,
  "status": "unknown",
  "keepalive_timestamp": 1726510079,
  "last_online": "unknown",
  "created_at": "2024-09-16T18:12:08.790Z",
  "updated_at": "2024-09-16T18:12:08.790Z",
  "virtual_nodes": [
  ],
  "puppet_environment": null,
  "puppet_masterless": null,
  "properties": {
    "my_lan1": "1.2.3.4"
  },
  "service_checks": {
    "docker_versions": [
    ]
  },
  "available_docker_images": null
}

Example 2: Create a new node and specify IP address and netmask properties

When creating a new node while specifying an IP address and netmask property in the request, the order that these properties are specified is important. If you want to specify a netmask value, you must specify the IP address property first and then the netmask property as in the following example.

If you specify a netmask property before an IP address property, the netmask property is ignored and a netmask value of /32 is used. It's important to verify in the response the API sends that the values you intended to set are used.

ruby api.rb <customer_code> post api/nodes '{"node_group_id": 2235, "instance_number": 0, "store_number": 2235, "properties": {"my_ipmi_ip":"172.20.40.183","my_ipmi_netmask":"24"}}'