All URIs are relative to https://app.launchdarkly.com
Method | HTTP request | Description |
---|---|---|
deleteContextInstances | DELETE /api/v2/projects/{projectKey}/environments/{environmentKey}/context-instances/{id} | Delete context instances |
evaluateContextInstance | POST /api/v2/projects/{projectKey}/environments/{environmentKey}/flags/evaluate | Evaluate flags for context instance |
getContextAttributeNames | GET /api/v2/projects/{projectKey}/environments/{environmentKey}/context-attributes | Get context attribute names |
getContextAttributeValues | GET /api/v2/projects/{projectKey}/environments/{environmentKey}/context-attributes/{attributeName} | Get context attribute values |
getContextInstances | GET /api/v2/projects/{projectKey}/environments/{environmentKey}/context-instances/{id} | Get context instances |
getContextKindsByProjectKey | GET /api/v2/projects/{projectKey}/context-kinds | Get context kinds |
getContexts | GET /api/v2/projects/{projectKey}/environments/{environmentKey}/contexts/{kind}/{key} | Get contexts |
putContextKind | PUT /api/v2/projects/{projectKey}/context-kinds/{key} | Create or update context kind |
searchContextInstances | POST /api/v2/projects/{projectKey}/environments/{environmentKey}/context-instances/search | Search for context instances |
searchContexts | POST /api/v2/projects/{projectKey}/environments/{environmentKey}/contexts/search | Search for contexts |
deleteContextInstances(projectKey, environmentKey, id)
Delete context instances
Delete context instances by ID.
import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';
let apiInstance = new LaunchDarklyApi.ContextsApi();
let projectKey = "projectKey_example"; // String | The project key
let environmentKey = "environmentKey_example"; // String | The environment key
let id = "id_example"; // String | The context instance ID
apiInstance.deleteContextInstances(projectKey, environmentKey, id, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
});
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
environmentKey | String | The environment key | |
id | String | The context instance ID |
null (empty response body)
- Content-Type: Not defined
- Accept: application/json
ContextInstanceEvaluations evaluateContextInstance(projectKey, environmentKey, requestBody, opts)
Evaluate flags for context instance
Evaluate flags for a context instance, for example, to determine the expected flag variation. Do not use this API instead of an SDK. The LaunchDarkly SDKs are specialized for the tasks of evaluating feature flags in your application at scale and generating analytics events based on those evaluations. This API is not designed for that use case. Any evaluations you perform with this API will not be reflected in features such as flag statuses and flag insights. Context instances evaluated by this API will not appear in the Contexts list. To learn more, read Comparing LaunchDarkly's SDKs and REST API. ### Filtering LaunchDarkly supports the `filter` query param for filtering, with the following fields: - `query` filters for a string that matches against the flags' keys and names. It is not case sensitive. For example: `filter=query equals dark-mode`. - `tags` filters the list to flags that have all of the tags in the list. For example: `filter=tags contains ["beta","q1"]`. You can also apply multiple filters at once. For example, setting `filter=query equals dark-mode, tags contains ["beta","q1"]` matches flags which match the key or name `dark-mode` and are tagged `beta` and `q1`.
import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';
let apiInstance = new LaunchDarklyApi.ContextsApi();
let projectKey = "projectKey_example"; // String | The project key
let environmentKey = "environmentKey_example"; // String | The environment key
let requestBody = {"key":"user-key-123abc","kind":"user","otherAttribute":"other attribute value"}; // {String: Object} |
let opts = {
'limit': 789, // Number | The number of feature flags to return. Defaults to -1, which returns all flags
'offset': 789, // Number | Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`.
'sort': "sort_example", // String | A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order
'filter': "filter_example" // String | A comma-separated list of filters. Each filter is of the form `field operator value`. Supported fields are explained above.
};
apiInstance.evaluateContextInstance(projectKey, environmentKey, requestBody, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
environmentKey | String | The environment key | |
requestBody | {String: Object} | ||
limit | Number | The number of feature flags to return. Defaults to -1, which returns all flags | [optional] |
offset | Number | Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. | [optional] |
sort | String | A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order | [optional] |
filter | String | A comma-separated list of filters. Each filter is of the form `field operator value`. Supported fields are explained above. | [optional] |
- Content-Type: application/json
- Accept: application/json
ContextAttributeNamesCollection getContextAttributeNames(projectKey, environmentKey, opts)
Get context attribute names
Get context attribute names.
import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';
let apiInstance = new LaunchDarklyApi.ContextsApi();
let projectKey = "projectKey_example"; // String | The project key
let environmentKey = "environmentKey_example"; // String | The environment key
let opts = {
'filter': "filter_example", // String | A comma-separated list of context filters. This endpoint only accepts `kind` filters, with the `equals` operator, and `name` filters, with the `startsWith` operator. To learn more about the filter syntax, read [Filtering contexts and context instances](https://launchdarkly.com/docs/ld-docs/api/contexts#filtering-contexts-and-context-instances).
'limit': 789 // Number | Specifies the maximum number of items in the collection to return (max: 100, default: 100)
};
apiInstance.getContextAttributeNames(projectKey, environmentKey, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
environmentKey | String | The environment key | |
filter | String | A comma-separated list of context filters. This endpoint only accepts `kind` filters, with the `equals` operator, and `name` filters, with the `startsWith` operator. To learn more about the filter syntax, read Filtering contexts and context instances. | [optional] |
limit | Number | Specifies the maximum number of items in the collection to return (max: 100, default: 100) | [optional] |
ContextAttributeNamesCollection
- Content-Type: Not defined
- Accept: application/json
ContextAttributeValuesCollection getContextAttributeValues(projectKey, environmentKey, attributeName, opts)
Get context attribute values
Get context attribute values.
import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';
let apiInstance = new LaunchDarklyApi.ContextsApi();
let projectKey = "projectKey_example"; // String | The project key
let environmentKey = "environmentKey_example"; // String | The environment key
let attributeName = "attributeName_example"; // String | The attribute name
let opts = {
'filter': "filter_example", // String | A comma-separated list of context filters. This endpoint only accepts `kind` filters, with the `equals` operator, and `value` filters, with the `startsWith` operator. To learn more about the filter syntax, read [Filtering contexts and context instances](https://launchdarkly.com/docs/ld-docs/api/contexts#filtering-contexts-and-context-instances).
'limit': 789 // Number | Specifies the maximum number of items in the collection to return (max: 100, default: 50)
};
apiInstance.getContextAttributeValues(projectKey, environmentKey, attributeName, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
environmentKey | String | The environment key | |
attributeName | String | The attribute name | |
filter | String | A comma-separated list of context filters. This endpoint only accepts `kind` filters, with the `equals` operator, and `value` filters, with the `startsWith` operator. To learn more about the filter syntax, read Filtering contexts and context instances. | [optional] |
limit | Number | Specifies the maximum number of items in the collection to return (max: 100, default: 50) | [optional] |
ContextAttributeValuesCollection
- Content-Type: Not defined
- Accept: application/json
ContextInstances getContextInstances(projectKey, environmentKey, id, opts)
Get context instances
Get context instances by ID.
import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';
let apiInstance = new LaunchDarklyApi.ContextsApi();
let projectKey = "projectKey_example"; // String | The project key
let environmentKey = "environmentKey_example"; // String | The environment key
let id = "id_example"; // String | The context instance ID
let opts = {
'limit': 789, // Number | Specifies the maximum number of context instances to return (max: 50, default: 20)
'continuationToken': "continuationToken_example", // String | Limits results to context instances with sort values after the value specified. You can use this for pagination, however, we recommend using the `next` link we provide instead.
'sort': "sort_example", // String | Specifies a field by which to sort. LaunchDarkly supports sorting by timestamp in ascending order by specifying `ts` for this value, or descending order by specifying `-ts`.
'filter': "filter_example", // String | A comma-separated list of context filters. This endpoint only accepts an `applicationId` filter. To learn more about the filter syntax, read [Filtering contexts and context instances](https://launchdarkly.com/docs/ld-docs/api/contexts#filtering-contexts-and-context-instances).
'includeTotalCount': true // Boolean | Specifies whether to include or omit the total count of matching context instances. Defaults to true.
};
apiInstance.getContextInstances(projectKey, environmentKey, id, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
environmentKey | String | The environment key | |
id | String | The context instance ID | |
limit | Number | Specifies the maximum number of context instances to return (max: 50, default: 20) | [optional] |
continuationToken | String | Limits results to context instances with sort values after the value specified. You can use this for pagination, however, we recommend using the `next` link we provide instead. | [optional] |
sort | String | Specifies a field by which to sort. LaunchDarkly supports sorting by timestamp in ascending order by specifying `ts` for this value, or descending order by specifying `-ts`. | [optional] |
filter | String | A comma-separated list of context filters. This endpoint only accepts an `applicationId` filter. To learn more about the filter syntax, read Filtering contexts and context instances. | [optional] |
includeTotalCount | Boolean | Specifies whether to include or omit the total count of matching context instances. Defaults to true. | [optional] |
- Content-Type: Not defined
- Accept: application/json
ContextKindsCollectionRep getContextKindsByProjectKey(projectKey)
Get context kinds
Get all context kinds for a given project.
import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';
let apiInstance = new LaunchDarklyApi.ContextsApi();
let projectKey = "projectKey_example"; // String | The project key
apiInstance.getContextKindsByProjectKey(projectKey, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key |
- Content-Type: Not defined
- Accept: application/json
Contexts getContexts(projectKey, environmentKey, kind, key, opts)
Get contexts
Get contexts based on kind and key.
import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';
let apiInstance = new LaunchDarklyApi.ContextsApi();
let projectKey = "projectKey_example"; // String | The project key
let environmentKey = "environmentKey_example"; // String | The environment key
let kind = "kind_example"; // String | The context kind
let key = "key_example"; // String | The context key
let opts = {
'limit': 789, // Number | Specifies the maximum number of items in the collection to return (max: 50, default: 20)
'continuationToken': "continuationToken_example", // String | Limits results to contexts with sort values after the value specified. You can use this for pagination, however, we recommend using the `next` link we provide instead.
'sort': "sort_example", // String | Specifies a field by which to sort. LaunchDarkly supports sorting by timestamp in ascending order by specifying `ts` for this value, or descending order by specifying `-ts`.
'filter': "filter_example", // String | A comma-separated list of context filters. This endpoint only accepts an `applicationId` filter. To learn more about the filter syntax, read [Filtering contexts and context instances](https://launchdarkly.com/docs/ld-docs/api/contexts#filtering-contexts-and-context-instances).
'includeTotalCount': true // Boolean | Specifies whether to include or omit the total count of matching contexts. Defaults to true.
};
apiInstance.getContexts(projectKey, environmentKey, kind, key, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
environmentKey | String | The environment key | |
kind | String | The context kind | |
key | String | The context key | |
limit | Number | Specifies the maximum number of items in the collection to return (max: 50, default: 20) | [optional] |
continuationToken | String | Limits results to contexts with sort values after the value specified. You can use this for pagination, however, we recommend using the `next` link we provide instead. | [optional] |
sort | String | Specifies a field by which to sort. LaunchDarkly supports sorting by timestamp in ascending order by specifying `ts` for this value, or descending order by specifying `-ts`. | [optional] |
filter | String | A comma-separated list of context filters. This endpoint only accepts an `applicationId` filter. To learn more about the filter syntax, read Filtering contexts and context instances. | [optional] |
includeTotalCount | Boolean | Specifies whether to include or omit the total count of matching contexts. Defaults to true. | [optional] |
- Content-Type: Not defined
- Accept: application/json
UpsertResponseRep putContextKind(projectKey, key, upsertContextKindPayload)
Create or update context kind
Create or update a context kind by key. Only the included fields will be updated.
import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';
let apiInstance = new LaunchDarklyApi.ContextsApi();
let projectKey = "projectKey_example"; // String | The project key
let key = "key_example"; // String | The context kind key
let upsertContextKindPayload = new LaunchDarklyApi.UpsertContextKindPayload(); // UpsertContextKindPayload |
apiInstance.putContextKind(projectKey, key, upsertContextKindPayload, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
key | String | The context kind key | |
upsertContextKindPayload | UpsertContextKindPayload |
- Content-Type: application/json
- Accept: application/json
ContextInstances searchContextInstances(projectKey, environmentKey, contextInstanceSearch, opts)
Search for context instances
Search for context instances. You can use either the query parameters or the request body parameters. If both are provided, there is an error. To learn more about the filter syntax, read Filtering contexts and context instances. To learn more about context instances, read Context instances.
import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';
let apiInstance = new LaunchDarklyApi.ContextsApi();
let projectKey = "projectKey_example"; // String | The project key
let environmentKey = "environmentKey_example"; // String | The environment key
let contextInstanceSearch = new LaunchDarklyApi.ContextInstanceSearch(); // ContextInstanceSearch |
let opts = {
'limit': 789, // Number | Specifies the maximum number of items in the collection to return (max: 50, default: 20)
'continuationToken': "continuationToken_example", // String | Limits results to context instances with sort values after the value specified. You can use this for pagination, however, we recommend using the `next` link we provide instead.
'sort': "sort_example", // String | Specifies a field by which to sort. LaunchDarkly supports sorting by timestamp in ascending order by specifying `ts` for this value, or descending order by specifying `-ts`.
'filter': "filter_example", // String | A comma-separated list of context filters. This endpoint only accepts an `applicationId` filter. To learn more about the filter syntax, read [Filtering contexts and context instances](https://launchdarkly.com/docs/ld-docs/api/contexts#filtering-contexts-and-context-instances).
'includeTotalCount': true // Boolean | Specifies whether to include or omit the total count of matching context instances. Defaults to true.
};
apiInstance.searchContextInstances(projectKey, environmentKey, contextInstanceSearch, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
environmentKey | String | The environment key | |
contextInstanceSearch | ContextInstanceSearch | ||
limit | Number | Specifies the maximum number of items in the collection to return (max: 50, default: 20) | [optional] |
continuationToken | String | Limits results to context instances with sort values after the value specified. You can use this for pagination, however, we recommend using the `next` link we provide instead. | [optional] |
sort | String | Specifies a field by which to sort. LaunchDarkly supports sorting by timestamp in ascending order by specifying `ts` for this value, or descending order by specifying `-ts`. | [optional] |
filter | String | A comma-separated list of context filters. This endpoint only accepts an `applicationId` filter. To learn more about the filter syntax, read Filtering contexts and context instances. | [optional] |
includeTotalCount | Boolean | Specifies whether to include or omit the total count of matching context instances. Defaults to true. | [optional] |
- Content-Type: application/json
- Accept: application/json
Contexts searchContexts(projectKey, environmentKey, contextSearch, opts)
Search for contexts
Search for contexts. You can use either the query parameters or the request body parameters. If both are provided, there is an error. To learn more about the filter syntax, read Filtering contexts and context instances. To learn more about contexts, read Contexts and context kinds.
import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';
let apiInstance = new LaunchDarklyApi.ContextsApi();
let projectKey = "projectKey_example"; // String | The project key
let environmentKey = "environmentKey_example"; // String | The environment key
let contextSearch = new LaunchDarklyApi.ContextSearch(); // ContextSearch |
let opts = {
'limit': 789, // Number | Specifies the maximum number of items in the collection to return (max: 50, default: 20)
'continuationToken': "continuationToken_example", // String | Limits results to contexts with sort values after the value specified. You can use this for pagination, however, we recommend using the `next` link we provide instead.
'sort': "sort_example", // String | Specifies a field by which to sort. LaunchDarkly supports sorting by timestamp in ascending order by specifying `ts` for this value, or descending order by specifying `-ts`.
'filter': "filter_example", // String | A comma-separated list of context filters. To learn more about the filter syntax, read [Filtering contexts and context instances](https://launchdarkly.com/docs/ld-docs/api/contexts#filtering-contexts-and-context-instances).
'includeTotalCount': true // Boolean | Specifies whether to include or omit the total count of matching contexts. Defaults to true.
};
apiInstance.searchContexts(projectKey, environmentKey, contextSearch, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
Name | Type | Description | Notes |
---|---|---|---|
projectKey | String | The project key | |
environmentKey | String | The environment key | |
contextSearch | ContextSearch | ||
limit | Number | Specifies the maximum number of items in the collection to return (max: 50, default: 20) | [optional] |
continuationToken | String | Limits results to contexts with sort values after the value specified. You can use this for pagination, however, we recommend using the `next` link we provide instead. | [optional] |
sort | String | Specifies a field by which to sort. LaunchDarkly supports sorting by timestamp in ascending order by specifying `ts` for this value, or descending order by specifying `-ts`. | [optional] |
filter | String | A comma-separated list of context filters. To learn more about the filter syntax, read Filtering contexts and context instances. | [optional] |
includeTotalCount | Boolean | Specifies whether to include or omit the total count of matching contexts. Defaults to true. | [optional] |
- Content-Type: application/json
- Accept: application/json