Query
Use the Warrant Query Language (WQL) to list the set of subjects that have access to a particular object or to list the set of objects a particular subject has access to.
GET /v2/query
Request
Headers
Warrant-Token string
, optional
A valid Warrant-Token from a previous write operation or latest
. Used to specify desired consistency for this read operation.
Query Params
q string
A query written in the Warrant Query Language (WQL).
context string
, optional
A serialized, url-safe JSON object containing contextual data to use while resolving the query. This data is used to evaluate any policies on warrants matched by the query. Any warrants with an attached policy that are matched by the query will not contribute any results to the result unless their attached policy evaluates to true
using the provided context
.
This endpoint supports all of the query parameters specified in the Pagination & Sorting section. Supported values for the sortBy
parameter are objectType
, objectId
, and createdAt
.
- cURL
- CLI
- Go
- Java
- Node.js
- Python
- Ruby
curl "https://api.warrant.dev/v2/query?q=select+pricing-tier,feature+where+user:12+is+member" \
-H "Authorization: ApiKey YOUR_KEY"
warrant query 'select pricing-tier,feature where user:12 is member'
queryResult, err := warrant.Query(
"select pricing-tier,feature where user:12 is member",
&warrant.ListWarrantParams{},
)
if err != nil {
// handle error
}
try {
QueryResultSet resultSet = client.query(
"select feature where user:12 is member",
new ListParams().withLimit(25)
);
} catch (WarrantException e) {
// Handle error
}
const warrants = await warrantClient.Warrant.query(
"select feature where user:12 is member",
{ limit: 25 }
);
warrants = warrant.Warrant.query("select feature where user:12 is member", opts={"limit": 25})
warrants = Warrant::Warrant.query("select feature where user:12 is member", filters: { limit: 25 })
Response
Body
results array
A list of query results.
prevCursor string
This attribute will be omitted from the response if there are no previous results to fetch.
nextCursor string
This attribute will be omitted from the response if there are no more results to fetch.
{
"results": [
{
"objectType": "pricing-tier",
"objectId": "enterprise",
"warrant": {
"objectType": "pricing-tier",
"objectId": "enterprise",
"relation": "member",
"subject": {
"objectType": "user",
"objectId": "12"
}
},
"isImplicit": false,
"meta": {
"name": "Enterprise",
"description": "Grants customers access to the features in our Enterprise tier."
}
},
{
"objectType": "pricing-tier",
"objectId": "basic",
"warrant": {
"objectType": "pricing-tier",
"objectId": "enterprise",
"relation": "member",
"subject": {
"objectType": "user",
"objectId": "12"
}
},
"isImplicit": true,
"meta": {
"name": "Basic",
"description": "Grants customers access to the features in our Free tier."
}
},
{
"objectType": "feature",
"objectId": "analytics",
"warrant": {
"objectType": "pricing-tier",
"objectId": "enterprise",
"relation": "member",
"subject": {
"objectType": "user",
"objectId": "12"
}
},
"isImplicit": true,
"meta": {
"name": "Analytics",
"description": "Grants customers access to the Custom Analytics value-add feature."
}
}
]
}