Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Tag API

lusis edited this page May 26, 2011 · 5 revisions

Tag API

This is the final 1.0 version of the Tag API.

Tagging is enabled across the following objects in the system:

  • Hosts
  • Services
  • Applications
  • Configurations
  • Ephemerals

Tags may only be applied to an individual object and not a group. Simply appending /tag to the end of a specific object's url and sending the list of tags will apply the tags to that object.

The specific object paths are as follows:

  • Hosts

    /hosts/host_name/tag

  • Services

    /services/service_name/host_name/tag

  • Applications

    /applications/application_name/tag

  • Configurations

    /configurations/configuration_name/tag

  • Ephemerals

    /ephemerals/some/ephemeral/path/tag

Note that for ephemerals, tags can be applied at any level of the path as ephemeral paths are not directly related. For instance, /ephemerals/foo/bar can have a different set of tags from /ephemerals/foo/bar/baz.

Also note that tagging is an idempotent operation. Should a object already have a given tag, the object will essentially remain unchanged. It will, however, still trigger a watcher callback.

Tags may be provided as a single tag or an array of tags.

/tags

  • GET: returns JSON representation of all tags

    • payload: none

    • success: 200

        {
          "ephemeral": {
            "ephemerals": {
              "/some/random/path/": {
        	"data": "{\"children\":[\"item1\", \"item2\"]}",
        	"id": "2",
        	"path": "/some/random/path/",
        	"links": [
        	  "/my_sample_organization"
        	]
              }
            },
            "created_at": "2011-04-12 06:07:10 UTC",
            "updated_at": "2011-04-12 06:07:10 UTC",
            "id": "3"
          },
          "production": {
            "created_at": "2011-04-12 06:07:10 UTC",
            "updated_at": "2011-04-12 06:07:10 UTC",
            "applications": {
              "myrailsapp1": {
        	"id": "2",
        	"links": [
        	  "/my_sample_organization"
        	],
        	"configurations": {
        	  "database.yml": {
        	    "format": "yaml",
        	    "body": "development:\n  database: development_database\n  adapter: mysql\n  username: dev_user\n  password: dev_password\n"
        	  }
        	}
              }
            },
            "id": "1"
          },
          "development": {
            "ephemerals": {
              "/some/random/path/": {
        	"data": "{\"children\":[\"item1\", \"item2\"]}",
        	"id": "2",
        	"path": "/some/random/path/",
        	"links": [
        	  "/my_sample_organization"
        	]
              }
            },
            "created_at": "2011-04-12 06:07:10 UTC",
            "updated_at": "2011-04-12 06:07:10 UTC",
            "id": "4",
            "services": {
              "noah": {
        	"localhost": {
        	  "id": "2",
        	  "links": [
        	    "/my_sample_organization"
        	  ],
        	  "status": "up"
        	}
              },
              "redis": {
        	"localhost": {
        	  "id": "1",
        	  "links": [
        	    "/my_sample_organization"
        	  ],
        	  "status": "up"
        	}
              }
            },
            "configurations": {
              "database.yml": {
        	"format": "yaml",
        	"body": "development:\n  database: development_database\n  adapter: mysql\n  username: dev_user\n  password: dev_password\n",
        	"id": "4",
        	"links": [
      
        	]
              }
            }
          }
        }
      
    • failure: 404

    • error: 500

  • PUT: not supported. Possible future support for bulk operations

  • POST: not supported. Possible future support for bulk operations

  • DELETE: not supported.

/tags/tag_name

  • GET: returns JSON representation of all objects with the given tag

    • payload: none

    • success: 200

        	{
        	  "development": {
        	    "ephemerals": {
        	      "/some/random/path/": {
        		"data": "{\"children\":[\"item1\", \"item2\"]}",
        		"id": "2",
        		"path": "/some/random/path/",
        		"links": [
        		  "/my_sample_organization"
        		]
        	      }
        	    },
        	    "created_at": "2011-04-12 06:07:10 UTC",
        	    "updated_at": "2011-04-12 06:07:10 UTC",
        	    "id": "4",
        	    "services": {
        	      "noah": {
        		"localhost": {
        		  "id": "2",
        		  "links": [
        		    "/my_sample_organization"
        		  ],
        		  "status": "up"
        		}
        	      },
        	      "redis": {
        		"localhost": {
        		  "id": "1",
        		  "links": [
        		    "/my_sample_organization"
        		  ],
        		  "status": "up"
        		}
        	      }
        	    },
        	    "configurations": {
        	      "database.yml": {
        		"format": "yaml",
        		"body": "development:\n  database: development_database\n  adapter: mysql\n  username: dev_user\n  password: dev_password\n",
        		"id": "4",
        		"links": [
      
        		]
        	      }
        	    }
        	  }
        	}
      
    • failure: 404

    • error: 500

  • PUT: not supported. Possible future support for bulk operations

  • POST: not supported. Possible future support for bulk operations

  • DELETE: not supported.

/*/tag

  • PUT: Adds tag(s) to the given endpoint

    • required options: tags

    • payload:

        {"tags":"some_tag"}
      

    or

      	{"tags":["tag1", "tag2", "tag3"]}
    
    • success: 200

        {
          "name": "redis",
          "created_at": "2011-04-12 01:35:03 UTC",
          "format": "string",
          "body": "redis://127.0.0.1:6379/0",
          "updated_at": "2011-04-12 01:35:03 UTC",
          "tags": [
            "tag1",
            "tag2",
            "tag3"
          ],
          "id": "1",
          "links": [
      
          ]
        }
      
    • failure: 404

    • error: 500

  • POST: not supported. Possible future support for bulk operations

  • DELETE: Deletes tag(s) from the given endpoint

    • required options: tags

    • payload:

        {"tags":"some_tag"}
      

    or

      	{"tags":["tag1", "tag2", "tag3"]}
    
    • success: 200

        {
          "name": "redis",
          "created_at": "2011-04-12 01:35:03 UTC",
          "format": "string",
          "body": "redis://127.0.0.1:6379/0",
          "updated_at": "2011-04-12 01:35:03 UTC",
          "tags": [
            "tag1",
            "tag2"
          ],
          "id": "1",
          "links": [
      
          ]
        }
      
    • failure: 404

    • error: 500

Clone this wiki locally