1

I want to retrieve all taxonomy term name using json api.

I have tried:

http://local-tes/jsonapi/taxonomy_term/specialties

but its only return 50 values, I want to fetch all taxonomy terms values.

1
  • I believe this is capped so the application doesn't crash from loading hundreds+ of potential entities. You'll need to loop and paginate over it or use a contrib module that increases the number returned.
    – Kevin
    Jan 11, 2023 at 11:50

1 Answer 1

1

See https://www.drupal.org/docs/core-modules-and-themes/core-modules/jsonapi-module/pagination#s--cant-i-set-a-page-limit-higher-than-50:

Why can't I set a page limit higher than 50?

First, read the example given above. Understand that JSON:API must run individual access checks for every entity in a response. Second, understand that the JSON:API module aims to be "zero configuration." You shouldn't have to install, alter or configure anything to use the module.

The reason for this is to protect your application from a DDoS attack. If a malicious API client set a page limit of 200,000 resources, the JSON:API module would need to run entity access checks for every one of those entities. This would quickly lead to out-of-memory errors and slow responses. The server needs to set a maximum. The limit of 50 was somewhat arbitrarily chosen as a nice round number.

Please understand that there have been many long conversations around this decision and a compromise had to be made between support burden, sane defaults, and frontend performance. While the JSON:API module maintainers do understand that this may not be ideal for every use case, they're confident that if your client follows the recommendations in these docs, it should have little to no impact on you :)

There is the JSON:API Page Limit module and also JSON API Defaults (part of the popular JSON:API Extras module) to change the limit.

After you have installed the JSON API Defaults module go to

http://example.com/admin/config/services/jsonapi/add/resource_types/taxonomy_term/[vocabulary]

and change the page limit at the bottom of the config form.

Then you can request a higher number of items with the query parameter page[limit]:

http://example.com/jsonapi/taxonomy_term/[vocabulary]?page[limit]=1000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.