PuppetDB 4.0: Edges endpoint

Included in Puppet Enterprise 2016.1. A newer version is available; see the version menu above for details.

Catalog edges are relationships formed between two resources. They represent the edges inside the catalog graph, whereas resources represent the nodes in the graph. You can query edges by making an HTTP request to the /edges endpoint.

/pdb/query/v4/edges

Returns all edges known to PuppetDB.

URL parameters

  • query: optional. A JSON array containing the query in prefix notation. If not provided, all results will be returned. See the sections below for the supported operators and fields. For general info about queries, see our guide to query structure.

Query operators

See the AST query language page.

Query fields

  • certname (string): the certname associated with the edge.
  • relationship (string): the edge relationship. Can be contains, before, required-by, notifies, or subscription-of.
  • source_title (string): the source resource title.
  • source_type (string, with first letter always capitalized): the source resource type.
  • target_title (string): the target resource title.
  • target_type (string, with first letter always capitalized): the target resource type.

Subquery relationships

The following list contains related entities that can be used to constrain the result set using implicit subqueries. For more information consult the documentation for subqueries.

  • nodes: node entity for the catalog of an edge.
  • catalogs: catalog entity for an edge.

Response format

The response is a JSON array of hashes, where each hash has the form:

{
  "certname": <string>,
  "relationship": <string>,
  "source_title": <string>,
  "source_type": <string>,
  "source_title": <string>,
  "source_type": <string>
}

Example

You can use curl to query information about nodes:

curl 'http://localhost:8080/pdb/query/v4/edges'

A sample response:

[ {
  "certname" : "host-5",
  "relationship" : "required-by",
  "source_title" : "httpd",
  "source_type" : "Package",
  "target_title" : "authn_file.load",
  "target_type" : "File"
}, {
  "certname" : "host-5",
  "relationship" : "contains",
  "source_title" : "/etc/apache2/ports.conf",
  "source_type" : "Concat",
  "target_title" : "concat_/etc/apache2/ports.conf",
  "target_type" : "Exec"
}, {
  "certname" : "host-5",
  "relationship" : "notifies",
  "source_title" : "deflate.load",
  "source_type" : "File",
  "target_title" : "httpd",
  "target_type" : "Service"
}, {
  "certname" : "host-5",
  "relationship" : "required-by",
  "source_title" : "mkdir /etc/apache2/mods-available",
  "source_type" : "Exec",
  "target_title" : "deflate.load",
  "target_type" : "File"
}, {
  "certname" : "host-5",
  "relationship" : "notifies",
  "source_title" : "concat_/etc/apache2/ports.conf",
  "source_type" : "Exec",
  "target_title" : "/etc/apache2/ports.conf",
  "target_type" : "File"
}, {
  "certname" : "host-5",
  "relationship" : "notifies",
  "source_title" : "authz_groupfile.load symlink",
  "source_type" : "File",
  "target_title" : "httpd",
  "target_type" : "Service"
} ]

Paging

This query endpoint supports paged results via the common PuppetDB paging URL parameters. For more information, please see the documentation on paging.

↑ Back to top