Back to Content Management API
contentEnvironments
Returns your store's content environments, paginated by a cursor.
Arguments
- Name
after- Type
- String
- Description
Returns the elements that come after the specified cursor.
- Name
before- Type
- String
- Description
Returns the elements that come before the specified cursor.
- Name
first- Type
- Int
- Description
Returns up to the first
nelements, at most 25.
- Name
last- Type
- Int
- Description
Returns up to the last
nelements, at most 25.
Returns
- Name
ContentEnvironmentConnection.edges- Type
- [ContentEnvironmentEdge]!
- Description
A list of edges.
- Name
ContentEnvironmentConnection.nodes- Type
- [ContentEnvironment]!
- Description
A list of content environments. Any requested field from the Content Environment object.
- Name
ContentEnvironmentConnection.pageInfo- Type
- PageInfo!
- Description
Information to aid in pagination.
- Name
ContentEnvironmentConnection.totalCount- Type
- Int
- Description
The number of content environments in your store.
Request
import { PackClient } from '@pack/client'
const packClient = new PackClient({
token: 'YOUR-PACK-TOKEN'
});
const query = `
query ContentEnvironments($first: Int) {
contentEnvironments(first: $first) {
nodes {
id
name
handle
}
totalCount
}
}
`;
const variables = {
first: 10
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"contentEnvironments": {
"nodes": [
{
"id": "YOUR-PRIMARY-ENVIRONMENT-ID",
"name": "Production",
"handle": "production"
},
{
"id": "YOUR-ENVIRONMENT-ID",
"name": "Staging",
"handle": "staging"
}
],
"totalCount": 2
}
}
}