provider Environments GET
/api/v2/projects/{projectKey}/environments @utdk/launchdarkly
/api/v2/projects/{projectKey}/environments List environments
Return a list of environments for the specified project.
By default, this returns the first 20 environments. Page through this list with the `limit` parameter and by following the `first`, `prev`, `next`, and `last` links in the `_links` field that returns. If those links do not appear, the pages they refer to don't exist. For example, the `first` and `prev` links will be missing from the response on the first page, because there is no previous page and you cannot return to the first page when you are already on the first page.
### Filtering environments
LaunchDarkly supports two fields for filters:
- `query` is a string that matches against the environments' names and keys. It is not case sensitive.
- `tags` is a `+`-separated list of environment tags. It filters the list of environments that have all of the tags in the list.
For example, the filter `filter=query:abc,tags:tag-1+tag-2` matches environments with the string `abc` in their name or key and also are tagged with `tag-1` and `tag-2`. The filter is not case-sensitive.
The documented values for `filter` query parameters are prior to URL encoding. For example, the `+` in `filter=tags:tag-1+tag-2` must be encoded to `%2B`.
### Sorting environments
LaunchDarkly supports the following fields for sorting:
- `createdOn` sorts by the creation date of the environment.
- `critical` sorts by whether the environments are marked as critical.
- `name` sorts by environment name.
For example, `sort=name` sorts the response by environment name in ascending order.
- projectKey path required
- The project key
- string
- limit query
- The number of environments to return in the response. Defaults to 20.
- integer
- offset query
- Where to start in the list. This is for use 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`.
- integer
- filter query
- A comma-separated list of filters. Each filter is of the form `field:value`.
- string
- sort query
- A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order.
- string
Try it
Authentication
Configure credentials for LaunchDarkly REST API
Gateway
The gateway proxies requests and injects credentials server-side. Configure credentials above, then enter your gateway URL.
Saved automatically to browser storage.
Code snippet
Updates live as you fill in the form above.
TypeScript
import launchdarkly from '@utdk/launchdarkly';
await launchdarkly.getenvironmentsbyproject()