Pagination in POST request in django rest api

in one of my django (rest api) project i have one requirement in which mobile team is passing some keys and data including page number through post request, according to that i need to return listing via pagination of their need.

i know how to achieve above operation via GET request, but can not use it as mobile team will be passing very lengthy data, which will not be suitable for GET request

Here is my code how do i do it via get request:

from rest_framework.pagination import PageNumberPagination
paginator = PageNumberPagination()
paginator.page_size = 10
result_page = paginator.paginate_queryset(songs, request)
if result_page is not None:
songs_data = []
next = paginator.page.next_page_number() if paginator.page.has_next() else None
previous = paginator.page.previous_page_number() if paginator.page.has_previous() else None
for item in result_page:
    # required operation

if anyone can help me how do i do it using page number received from the body of POST request, will be appreciated

Back to Top