Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

opCore Integration (API version 1, Node config/info/status)

opCore API V1 is supported in opCharts 3.X, for opCharts version 4.0.9 or greater, please refer to opCore API V2

opCore provides access to common data shared through all Opmantek applications.  Not all applications expose or use all parts of opCore, opCharts allows access to the functionality below. 

When listing resources (viewing the index) the default behaviour is to show only what has been asked for, by default only showing the ID's and modifiers will build up the info requested.  When an individual resource is requested (show) all info is provided by default and modifiers will pair down the info provided.

Authentication is required to access all methods below.

API Endpoint

All requests are made under the following base URL: 

...

Request Modifiers (query parameters)

Currently 2 request modifiers are available.  The The properties request modifier tells opCore which properties you would like listed, query limits the requested resources to only those that match all criteria given.

Not all requests will use all request modifiers. Arrays / KVP's are url encoded JSON. E.G.  javascript: urlencode(JSON.stringify(array)); perl: URI::Escape::uri_escape(encode_json($array));

Query ParameterPossible Values
properties

Array of property names. If provided only the properties specified will be returned (instead of the whole document), special property of opcore_all_properties will return all known properties.

eg: properties=["status.nodeModel","info.system.cbqos"]

query

Array of key=value pairs, but coded in an array. Applied to the list of results in the order they are given. If an application key is provided that will be applied first.

eg: query=["config.group","NMIS8","status.nodestatus","reachable"] (which is "config.group"="NMIS8" AND "status.nodestatus"="reachable" )

Examples of how to use the request modifiers can be found in the response blocks below.  In general, the queries will look something like this: 

...

Code Block
# no properties or query requested
# GET /omk/opCharts/v1/nodes/
[
	"$UUID1", # node1
	"$UUID2", # node2,
	...
	"$UUIDn"
]
 
# query only: query=["config.group","group_1","summary.roleType","core"]
# GET /omk/opCharts/v1/nodes/?query=["config.group","group_1","summary.roleType","core"]
[
	"$UUID2",
	"$UUD142"
]
 
# properties only: properties=["name","server_name"]
# GET /omk/opCharts/v1/nodes/?properties=["name","server_name"]
[
	{
		"node_id": "$UUID1",
		"name": "node_name_1",
		"server_name": "server_name"
	},
	...
]

 
# query and properties: query=["node_name","asgard"]&properties=["config.group"]
# GET /omk/opCharts/v1/nodes/?query=["node_name","asgard"]&properties=["config.group"]
[
  {
    "node_id": "C1135780-9AE1-11E4-A17D-1794FCA8A343",
    "config": {
      "group": "Branches"
    }
  }
]

...

Code Block
# no properties specified, all data is returned, this will have some common data structures and some specific to the node / model
# GET /omk/opCharts/v1/nodes/UUID1
{
	"node_id": "$UUID1",
	"name": "node1"
	"config": { ... full of info data from this nodes Nodes.nmis section ... },
	"info": { ... full of info data from this nodes "name-node.json" file ... },
	"status": { ... full of info data from this nodes nmis-nodesum.json section ... },
	...
}
# properties=["node_id","config.group","info.system.sysDescr"]
# GET /omk/opCharts/v1/nodes/UUID1?properties=["node_id","config.group","info.system.sysDescr"]
{
	"node_id": "$UUID1",
	"config": {
		group: "group1"
	},
	info: {
		system: {
			sysDescr: "something really long and full of great info"
		}
	}
}

...