-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to getEnvironments from space #236
Comments
Hi @snurby7, This should work (and works for me):
|
Hey @jroehl, Yeah I'm running this on a little node server. Just so we're on the same page what version of Here's an example of how I'm trying to call it. export class ContentManager {
private client: ClientAPI;
constructor() {
this.client = createClient({
// This is the access token for this space. Normally you get the token in the Contentful web app
accessToken: ContentfulAccessToken
});
}
public async getSpaces(): Promise<Collection<Space>> {
return this.client.getSpaces();
}
public async getEntriesForSpace(spaceId: string): Promise<any> {
const space = await this.client.getSpace(spaceId);
const environment = await space.getEnvironment("master");
const entries = await environment.getEntries();
console.log(entries);
return entries;
}
} When I call
|
All good, I made a terrible mistake higher up the chain. |
Can you share your "terrible mistake" - I think I am doing the same :-( |
If I knew what it was I'd tell you, probably just some bad logic where I was calling on the wrong environment or not waiting for something, sadly I don't have access to that old code anymore :/ |
it's easy to mistakenly use the access token in Settings - API Keys (content delivery) vs Settings - CMA tokens. |
Using the content-management api and looking at the docs
getEnvironments()
here there is a missing piece in the URL created.Per the docs the url should be
/spaces/{space_id}/environments
Instead what is sent dropped the
{space_id}
and instead queries to/spaces/environments
Using the latest package
contentful-management@5.11.2
The text was updated successfully, but these errors were encountered: