contentful / contentful.js

JavaScript library for Contentful's Delivery API (node & browser)
https://contentful.github.io/contentful.js
MIT License
1.19k stars 198 forks source link

Can't get more than 100 content types with getContentTypes call #2201

Open ryancooper7 opened 6 months ago

ryancooper7 commented 6 months ago

Expected Behavior

getContentTypes should allow an options object similar to getEntries that allows the response limit and/ or pagination to be used, or documentation should be added to show how to use limit or pagination in the query parameter. This would allow more than 100 content types to be retrieved.

Actual Behavior

There is no ability to pass an options object to the getContentTypes call. It only accepts a single parameter called query and it is unclear how to use this field to retrieve more content types, or if it is possible. I have tried the following options for the query string and had no success with any of them limit=1000, limit: 1000, limit:1000 etc. This makes this call useless in a space with > 100 content types as there is no way to increase the limit or paginate

Possible Solution

Add a parameter to the getContentTypes call that matches the options object on getEntries or provide documentation for what string to pass to the query parameter

Steps to Reproduce

  1. Run the following query on a space with >100 content types: const allContentTypes = await client.getContentTypes();

Context

We are using the contentful Javascript SDK in our project but I have not been able to make this call to retrieve all of our content types because of the limiting issue. I can achieve this with an API call to the content delivery API but would prefer to stick to one method of querying content

axe312ger commented 1 week ago

The limit for this endpoint is fixed to 100. If you have more than one hundred content types, you can call the endpoint again set the skip argument to the number of content types you already fetched.