Pre-requisites
- OS – Centos 7
- Python 3.6.4
- Django 3.0 (or 3.1.1)
- Django Rest framework 3.11.1
- django-rest-framework-datatables 0.5.0
- Apache 2.4
- ORACLE 19.1
I have a simple Rest API – which fetches all data from a table in Oracle database. This Django Framework is hosted on Apache webserver. This data is fed into a datatable using the django-rest-framework-datatables.
- When I fetch data from the API using djangorest framework it works well.
- When I fetch data using the template with
?format=datatables
as the query parameter the URL is changed and it becomes a very long URL since my table consists of 50-60 columns. - Thus throws a 414 error.
Did anybody else face this error ?
It works well with the django’s inherent webserver but when used using Django fails.
2
Answers
Yes, I faced such issue and reconfigured the code to shorten the URI.
Django-rest-framework datatables also support POST requests which solves this particular problem of too long GET URIs, see:
https://django-rest-framework-datatables.readthedocs.io/en/latest/tutorial.html#using-datatables-via-post-method
and:
https://datatables.net/examples/server_side/post.html