Bulk copy a single property (legacy)
This is the legacy way to bulk copy a property. For the latest bulk copy method that provides a way to bulk copy multiple properties, see Bulk copy multiple properties from a node source.
POST api/properties/property_template_name/values
Copy a property value from a node or node group to one or more targets.
Request syntax
post api/properties/<property_template_name>/values '{"source":{"hostname":"sit0001red0"},"target": {"hostnames": ["sit0001red0","sit0001red1"],"group_names": ["Node Group 1","Node Group 2"]}}'
Request parameters
The request accepts the following data in JSON format.
| Parameter | Type | Description | Required |
|---|---|---|---|
source | Hash | The source node or node group that contains the property value to be copied. You can specify only one source per request. | Yes |
target | Hash | The target details to copy the property value to. | Yes |
Source hash parameters
The source hash parameter accepts the following parameters.
| Parameter | Type | Description | Required |
|---|---|---|---|
| property template name | String | The property template name is specified as part of the endpoint path. | Yes |
hostname | String | The hostname of the node that contains the property value to be copied. | Only if group_name isn't present or empty. |
group_name | String | The name of the node group that contains the property value to be copied. | Only if hostname isn't present or empty. |
Target hash parameters
The target hash parameter accepts the following parameters.
| Parameter | Type | Description | Required |
|---|---|---|---|
hostnames | String array | The list of target node hostnames to copy the property values to. | Only if group_names, saved_filter_id, or saved_filter_name is not present or empty. |
group_names | String array | The list of node group names to copy the property values to. | Only if hostnames, saved_filter_id, or saved_filter_name is not present or empty. |
saved_filter_id | Integer | The property value is copied to all nodes filtered by this saved filter. It only accepts filters that apply to nodes. | Only if hostnames, saved_filter_name, or group_names is not present or empty. |
saved_filter_name | String | The property value is copied to all nodes filtered by this saved filter. It only accepts filters that apply to nodes. | Only if hostnames, saved_filter_id, or group_names is not present or empty. |
Response syntax
{
"successful_target_count": integer,
"failed_target_count": integer,
"failed_targets": [
{
"hostname": "string",
"message": "string"
}
]
}
Response parameters
If the action is successful, an HTTP 200 response is returned. The following data is returned in JSON format.
| Field | Type | Description |
|---|---|---|
successful_target_count | Integer | The number of successful copies. |
failed_target_count | Integer | The number of failed copies. |
failed targets | String array | The details of each failed copy. The hostname or group_name is included with an error message. |
exporter_job | Integer | The ID of the exporter job carrying out the request. |
Errors
The following are common errors returned by this API.
| Code | Message | Cause |
|---|---|---|
| 200 | Source property not enabled. | The property being copied from the source doesn't exist on the target. |
| 400 | Validation Failed: source is missing | The request has no source. |
| 422 | Source property not found. | The property does not exist on the source node or node group. |
Examples
Example 1: Bulk copy a property value from one node to multiple target nodes.
This example bulk copies the value of the my_docker_app1_tag property from node sit0018red0 to nodes sit0022red0 and sit0022red1.
ruby api.rb <customer_code> post api/properties/my_docker_app1_tag/values '{"source": {"hostname": "sit0018red0"},"target": {"hostnames": ["sit0022red0","sit0022red1"]}}'
Response
{
"successful_target_count": 2,
"failed_target_count": 0,
"exporter_job": 1563582
}
Example 2: Bulk copy a property value from one node to multiple target node groups.
This example bulk copies the value of property my_bridge0 from node sit0018red0 to node groups RedBox NA and RedBox SA.
ruby api.rb <customer_code> post api/properties/my_bridge0/values '{"source": {"hostname": "sit0018red0"},"target": {"group_names": ["RedBox NA","Redbox SA"]}}'
The response has the same format as the response in Example 1.
Example 3: Bulk copy a property value from one node to a mixed target of nodes and node groups.
This example bulk copies the value of the my_bridge0 property from node sit0018red0 to nodes sit0022red0 and sit0022red1 and to node groups RedBox NA and RedBox SA.
ruby api.rb <customer_code> post api/properties/my_bridge0/values '{"source": {"hostname": "sit0018red0"},"target": {"hostnames": ["sit0022red0","sit0022red1"],"group_names":["RedBox NA","RedBox SA"]}}'
The response has the same format as the response in Example 1.