0

I have an API call to the Django Api. If a request api/v2/unit/?page_size=80 comes in it works as required. If i use api/v2/unit/?page_size=1000 then I get 414 Client Error:

Request-URI Too Long

I presume the it fails because the requested page_size is bigger than the available page_size.

Can I dynamically change/overwrite the page_size by counting the queryset.

Mushahid Khan
  • 2,816
  • 1
  • 19
  • 32
sir_t
  • 133
  • 1
  • 3
  • 12
  • Maybe a duplicate of http://stackoverflow.com/questions/2891574/how-do-i-resolve-a-http-414-request-uri-too-long-error – Raphaël Gomès Jun 01 '16 at 12:19
  • Can you tell where the 414 error comes from? Is it Django, Apache or Nginx? Your url seems well within any reasonable limit. I've never seen that error come from django or django rest framework. – Håken Lid Jun 01 '16 at 12:34
  • I presume it's django because I'm using manage.py runserver to run the application. – sir_t Jun 01 '16 at 12:38
  • The default DRF pagination does not have a max page size limit. And in any case, _Request-URI Too Long_ seems like a strange response if your query is invalid. http://www.django-rest-framework.org/api-guide/pagination/#configuration_1 – Håken Lid Jun 01 '16 at 12:39
  • I'm not sure what the uri limit is in that case. But it's typically something like 2048 characters. Something like `http://localhost/api/v2/unit/?page_size=1000` would be much shorter than that. Can you get a stacktrace for the error? – Håken Lid Jun 01 '16 at 12:42
  • Seems like django only raises this error when the uri is longer than 65536 characters. I don't think it has anything to do with the `page_size` parameter. – Håken Lid Jun 01 '16 at 12:56

0 Answers0