Skip to content
This repository has been archived by the owner on Mar 5, 2020. It is now read-only.

Commit

Permalink
Fixes #5951: Missing nodekey=value tag API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
fanf committed Dec 9, 2014
1 parent e4aea13 commit b7740b2
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions src/api_v2/node.md
Expand Up @@ -291,6 +291,65 @@ HTTP/1.1 200 OK

*/

== [POST] api/nodes/{id}

/**
@api {post} /api/nodes/id 4. Set Node properties
@apiVersion 5.0.0
@apiName updateNodeProperties
@apiGroup Nodes

@apiStructure nodeId

@apiDescription This API allows to set "key=value" properties in node. This properties are then returned in the node details under the "properties" key, and they can be used to define group.
Value are non-empty UTF-8 strings. Setting a key to the empty string removed it from the list of properties for that node.

@apiExample Given the "properties.json" JSON file with content:
{ "properties": [
{ "name": "env_type" , "value": "production" },
{ "name": "shell" , "value": "/bin/sh" },
{ "name": "utf-8 poetry", "value": "ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ" }
] }


@apiExample Setting keys from "properties.json":
curl -H "X-API-Token: yourToken" -X POST -H "Content-Type: application/json" http://rudder.example.com/rudder/api/latest/nodes/NodeID -d @properties.json

@apiSuccessExample Success-Response:
HTTP/1.1 200 OK
{
"action": "updateNodeProperties",
"id": "4db088c8-d849-4f08-bfa9-ac96a22d461a",
"result": "success",
"data": {
"properties": [
{
"name": "env_type",
"value": "production"
},
{
"name": "shell",
"value": "/bin/sh"
},
{
"name": "utf-8 poetry",
"value": "ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ"
}
]
}
}

@apiExample Removing the key "utf-8 poetry" from the command line and updating the "env_type" one:
curl -H "X-API-Token: yourToken" -X POST -H "Content-Type: application/json" http://rudder.example.com/rudder/api/latest/nodes/NodeID -d '{ "properties": [{ "name":"utf-8 poetry", "value":""}, {"name":"env_type", "value":"unprovisionning"}] }'

@apiExample Removing the key "env_type" and changing "shell" (no JSON):
curl -H "X-API-Token: yourToken" -X POST http://rudder.example.com/rudder/api/latest/nodes/NodeID -d "properties=shell=/bin/false" -d "properties=env_type="

*/




== [DELETE] api/nodes/{id}

/**
Expand Down

0 comments on commit b7740b2

Please sign in to comment.