Queries define GraphQL operations which retrieve data from the server. They return only the data you specify, based on the fields which you provide in a query. If an object is returned, then you must specify the fields of that object which you want to return. The final result of the query must only return scalars.
At the start of every query operation, ensure that you specify query
before the field(s).
Query Variables
We use variables throughout our example requests. We do this in order to mirror real-world application practices whereby you would most likely want dynamic values for your arguments. Take a look at this guide if you’re unfamiliar with how variables work in GraphQL.
Retrieve a Feature.
Name | Type | Description |
---|---|---|
id | String! | The id of the feature. This maps to the id field as set on the Feature object. |
Name | Type | Description |
---|---|---|
data | Feature! | The Feature corresponding to the id you passed. |
errors / error | See Errors | Returns any errors which may have occurred with the request. |
List all Features.
Name | Type | Description |
---|---|---|
data | [Feature!]! | An array of all features. |
errors / error | See Errors | Returns any errors which may have occurred with the request. |
Understand if a User is able to use a particular Feature.
The returned access
boolean is true
when the user has access (for Binary features), has enough of a feature remaining to be used (for Consumable features), or has overage enabled (for Consumable features).
Name | Type | Description |
---|---|---|
featureId | String! | The id of the feature. This maps to the id field as set on the Feature object. |
userId | String! | The id of the user. This maps to the id field as set on the User object. |
delta | Int | The amount of the consumable feature which the user will be using and you want to check access against. Defaults to 1 . |
Name | Type | Description |
---|---|---|
data | CanUseFeatureData! | An object containing details on if the user can use the feature (access , reason ) and on a user’s current Consumption of the feature (consumption ). |
errors / error | See Errors | Returns any errors which may have occurred with the request. |
Retrieve both the current and historical usage of a Feature for a User.
Why can I only see the current usage through the SDKs?
We’re in the process of returning past usage of a feature via our SDKs. Let us know if you’d love to see it and we’ll keep you posted on when it’s launched!
Name | Type | Description |
---|---|---|
userId | String! | The id of the user. This maps to the id field as set on the User object. |
featureId | String! | The id of the feature. This maps to the id field as set on the Feature object. |
Name | Type | Description |
---|---|---|
data | ShowUsageData! | An object containing details on the how many of the feature a user has used (usages ) and since when (since ). |
errors / error | See Errors | Returns any errors which may have occurred with the request. |
Retrieve a Package.
Name | Type | Description |
---|---|---|
id | String! | The id of the package. This maps to the id field as set on the Package object. |
includeFeatures | Boolean | SDK Only. Whether you want a features array to be present as part of the response. Defaults to false . |
Name | Type | Description |
---|---|---|
data | Package! | The Package corresponding to the id you passed. |
errors / error | See Errors | Returns any errors which may have occurred with the request. |
List all Packages.
Name | Type | Description |
---|---|---|
status | String | The status of the package. Maps to one of the PackageStatus enum options. Defaults to PUBLISHED . |
includeFeatures | Boolean | SDK Only. Whether you want a features array to be present as part of the response. Defaults to false . |
Name | Type | Description |
---|---|---|
data | [Package!]! | An array of all packages. |
errors / error | See Errors | Returns any errors which may have occurred with the request. |
Retrieve a User.
Name | Type | Description |
---|---|---|
id | String! | The id of the user. This maps to the id field as set on the User object. |
Name | Type | Description |
---|---|---|
user | User! | The User corresponding to the id you passed. |
errors / error | See Errors | Returns any errors which may have occurred with the request. |
List all Users.
Name | Type | Description |
---|---|---|
data | [User!]! | An array of all users. |
errors / error | See Errors | Returns any errors which may have occurred with the request. |
Retrieve a PackageSubscription.
Name | Type | Description |
---|---|---|
id | String! | The id of the subscription. This maps to the id field as set on the PackageSubscription object. |
Name | Type | Description |
---|---|---|
data | PackageSubscription! | The PackageSubscription of a user to a package. This corresponds to the id you passed. |
errors / error | See Errors | Returns any errors which may have occurred with the request. |
List all PackageSubscriptions, or all PackageSubscriptions associated to a User.
Name | Type | Description |
---|---|---|
userId | String | The id of the User whose PackageSubscriptions you want to fetch. |
Name | Type | Description |
---|---|---|
data | [PackageSubscription!] | A list of subscriptions. These could correspond to a User if a userId is passed. |
errors / error | See Errors | Returns any errors which may have occurred with the request. |