List resources

Lists resources within an organization account.

If a kind query parameter is given, narrows results to only resources of that kind.

If a limit is given, returns no more than that number of results. Providing an offset skips a number of resources before returning the rest. In addition, providing an offset will give limit a default value of 10 if none other is provided. These two parameters can be combined to page through results.

If the parameter count is true, returns only the number of items in the list.

If the role or acting_as query parameter is given, then the resource list can be retrieved for a different role (as long as the authenticated role has access).

Text search

If the search parameter is provided, narrows results to those pertaining to the search query. Search works across resource IDs and the values of annotations. It weights results so that those with matching id or a matching value of an annotation called name appear first, then those with another matching annotation value, and finally those with a matching kind.

Kinds of resources

Kind

Description

User

One unique human

Host

A single logical machine (in the broad sense, not just physical)

Layer

A collection of hosts that have the same privileges

Group

A collection of users and groups that have the same privileges

Policy

Privileges on policies enable a user to create and modify objects and permissions

Variable

A secret such as a password, API key, SSH key, etc

Webservice

An HTTP(S) web service which performs sensitive operations

URI

 
GET /resources/{account}{?kind}{?search}{?limit}{?offset}{?count}{?acting_as}

Example URI

 
GET /resources/myorg?kind=variable?search=password?limit=2?offset=6?count=false

URI Parameters

Parameter

Type

Mandatory

Description

account

String

Yes

Organization account name

Example: myorg

kind

String

No

Kind of object to list

Example: variable

search

String

No

Search term used to narrow results

Example: password

limit

number

No

Number of results to return

Example: 2

offset

number

No

Number of results to skip

Example: 6

count

boolean

No

If true, return only the number of items in the list

Example: false

acting_as

String

No

The fully qualified identifier for the role whose resource list you want to view. It should be entered as {account}:{kind}:{identifier} where the identifier is URL-encoded. For more information about URL encoding, see URI.

Example: myorg:user:alice

List resources from an Edge

Consider the following when you send a request directly to an Edge:

  • Only variable resources (kind=variable) can be listed directly from an Edge. Requests for any other kind of resources are forwarded to Conjur Cloud.

  • If a request for variable resources contains parameters other than limit or offset, the request is forwarded to Conjur Cloud.

  • Responses from an Edge contain only the variable's ID (see see Response 200 > Example 2 below). For a full response, send the request directly to Conjur Cloud.

Example with curl

Suppose your organization name is “myorg” and you want to search for the first two resources matching the word “db”:

 
curl -H "$(conjur authn authenticate -H)" \
     'https://eval.conjur.org/resources/myorg?search=db&limit=2'

Request header

Field

Description

Example

Authorization

Conjur access token

Token token=“eyJkYX…Rhb=”

 
Authorization: Token token="eyJkYX...Rhb="

Response

Code

Description

200

Resources returned as a JSON list.

A list of variable resources sent from an Edge displays variable IDs only. For examples, see Response 200 below.

401

The request lacks valid authentication credentials

403

The authenticated user lacks the necessary privilege

See response examples below.

Response 200

Headers

 
Content-Type: application/json

Body

 
[
  {
    "created_at": "2017-07-25T06:30:38.768+00:00",
    "id": "myorg:variable:app-prod/db-password",
    "owner": "myorg:policy:app-prod",
    "policy": "myorg:policy:root",
    "permissions": [],
    "annotations": [],
    "secrets": [
      {
        "version": 1
      }
    ]
  },
  {
    "created_at": "2017-07-25T06:30:38.768+00:00",
    "id": "myorg:policy:app-prod",
    "owner": "myorg:user:admin",
    "policy": "myorg:policy:root",
    "permissions": [],
    "annotations": [],
    "policy_versions": []
  }
]