/policyengine/v1/policies: GET and /policyengine/v1/policies/<policy_name>: GET

Lists the attributes of one or more policies.

These two endpoints list the attributes either of a specified policy or of all the policies in the system. The following table shows which roles can access these two REST API endpoints:
Table 1. Access by role
Endpoints Data admin Data user Collection Admin Collection user Admin Service user
/policyengine/v1/policies: GET 1 Χ Χ
/policyengine/v1/policies/<policy_name>: GET 1 Χ Χ
1 Collection Admin user can list, update, and delete policies applied to the collections to which they have the Collection Admin role assigned.

Synopsis of the request URL

curl -k -H 'Authorization: Bearer <token>' https://<spectrum_discover_host>/policyengine/v1/
policies -X GET -H ’Accept: application/json’
or
curl -k -H 'Authorization: Bearer <token>' https://<spectrum_discover_host>/policyengine/v1/
policies/<policy_name> -X GET -H ’Accept: application/json’

Supported request types and response formats

Supported request types:
  • GET
Supported response formats:
  • JSON

Examples

  1. The following example returns information about all the policies that are configured in the system:
    1. Issue the following request on one line:
      curl -k -H 'Authorization: Bearer <token>' 
      https://<spectrum_discover_host>
      /policyengine/v1/policies -X GET -H ’Accept: application/json’
    2. The following response is returned:
      [
         {
            "pol_id": "pol1",
            "action_id": "AUTOTAG",
            "action_params": {
               "tags": {
               "tag2": "val2",
               "tag3": "val3"
               }
            },
            "schedule": {
            "dayOfWeek": 4,
            "hour": 5,
            "minute": 15
            }
            "pol_state": "active"
            "pol_filter": "filetype='jpg'",
         }, 
      {
         "pol_id": "pol2",
            "action_id": "AUTOTAG",
            "action_params": {
               "tags": {
               "tag4": "val4",
               "tag5": "val5"
               }
            },
            "schedule": "NOW",
            "pol_state": "active"
            "pol_filter": "filetype='jpg'",
         }
      ]
  2. The following example returns information about the specified policy:
    1. Issue the following request on one line:
      curl -k -H 'Authorization: Bearer <token>'   
      https://<spectrum_discover_host>
      /policyengine/v1/policies/pol1 -X GET -H ’Accept: application/json’
    2. The following response is returned:
      [
         {
            "pol_id": "pol1",
            "action_id": "AUTOTAG",
            "action_params": {
               "tags": {
               "tag2": "val2",
               "tag3": "val3"
               }
            },
            "schedule": {
            "dayOfWeek": 4,
            "hour": 5,
            "minute": 15
            }
            "pol_filter": "filetype='jpg'",
            "pol_state": "active"
         }
      ]