Retrieve a specific policy
Returns the complete policy identified by the policyId path parameter. The
response contains the policy as JSON object.
Tip: If you don't know the policy ID of a thing, request it via GET /things/{thingId}.
Optionally, you can use the field selectors (see parameter fields) to only get specific fields,
which you are interested in.
Example:
Use the field selector _revision to retrieve the revision of the policy.
Parameters
policyIdstringrequiredpathThe ID of the policy needs to follow the namespaced entity ID notation (see Ditto documentation on namespaced entity IDs).
The namespace needs to:
- conform to the reverse domain name notation
fieldsstringqueryContains a comma-separated list of fields to be included in the returned JSON.
Selectable fields
policyIdentriesSupports selecting arbitrary sub-fields by using a comma-separated list:
several entry paths can be passed as a comma-separated list of JSON pointers (RFC-6901)
For example:
?fields=entries/dittowould select only thedittoentry value(if present)?fields=entries/ditto,entries/userwould select onlydittoanduserentry values (if present)
Supports selecting arbitrary sub-fields of objects by wrapping sub-fields inside parentheses
( ):a comma-separated list of sub-fields (a sub-field is a JSON pointer (RFC-6901) separated with
/) to selectsub-selectors can be used to request only specific sub-fields by placing expressions in parentheses
( )after a selected subfieldFor example:
?fields=entries(ditto,user)would select onlydittoanduserentry values (if present)?fields=entries(ditto/subjects)would select thesubjectsvalue inside thedittoentry?fields=entries/ditto/subjects(issuer:google,issuer:azure)would select theissuer:googleandissuer:azurevalues inside thesubjectsobject inside theentriesobject
_namespaceSpecifically selects the namespace also contained in the
policyId_revisionSpecifically selects the revision of the policy. The revision is a counter, which is incremented on each modification of a policy.
_createdSpecifically selects the created timestamp of the policy in ISO-8601 UTC format. The timestamp is set on creation of a policy.
_modifiedSpecifically selects the modified timestamp of the policy in ISO-8601 UTC format. The timestamp is set on each modification of a policy.
_metadataSpecifically selects the Metadata of the policy. The content is a JSON object having the policy's JSON structure with the difference that the JSON leaves of the policy are JSON objects containing the metadata.
Examples
?fields=policyId,entries,_revision?fields=entries(ditto,user),_namespace
If-MatchstringheaderThe If-Match header, which has to conform to RFC-7232 (Conditional Requests). Common usages are:
- optimistic locking by specifying the
ETagfrom a previous GET response, e.g.If-Match: "rev:4711" - retrieving or modifying a resource only if it already exists, e.g.
If-Match: *
If-None-MatchstringheaderThe If-None-Match header, which has to conform to RFC-7232 (Conditional Requests). A common usage scenario is to modify a resource only if it does not yet exist, thus to create it, by specifying If-None-Match: *.
timeoutstringqueryDefines how long the backend should wait for completion of the request, e.g. applied when waiting for requested
acknowledgements via the requested-acks param. Can be specified without unit (then seconds are assumed) or
together with s, ms or m unit. Example: 42s, 1m.
The default (if omitted) and maximum timeout is 60s. A value of 0 applies fire and forget semantics for
the command resulting in setting response-required=false.
Response
The request successfully returned completed and returned is the policy.
The (sub-)resource has not been modified. This happens when you specified a If-None-Match header which matches the current ETag of the (sub-)resource.
The request could not be completed. Possible reasons:
- the
policyIddoes not conform to the namespaced entity ID notation (see Ditto documentation on namespaced entity IDs)
The request could not be completed due to missing authentication.
The request could not be completed. The policy with the given ID was not found in the context of the authenticated user.
A precondition for reading or writing the (sub-)resource failed. This will happen for write requests, if you specified an If-Match or If-None-Match header, which fails the precondition check against the current ETag of the (sub-)resource. For read requests, this error may only happen for a failing If-Match header. In case of a failing If-None-Match header for a read request, status 304 will be returned instead.
Authorization
OpenIDConnectopenIdConnectOpenID Connect Discovery URL. The placeholder is replaced by Swagger UI when configured.
NginxBasichttp (basic)Eclipse Ditto sandbox demo user (demo1 ... demo9) + password (demo)
Bearerhttp (bearer)A JSON Web Token issued by a supported OAuth 2.0 Identity Provider.