I am trying to upload document from a source using the REST API.
The problem is I find a discrepancy between what is written in the swagger and what is actually returned by Mayan.
When i try to get the list of file available in the selected source I use the action ‘file_list’ and ask for pagination because i know there will be a lot of files. Here is the request :
curl -X 'GET' \
'http://localhost/api/v4/sources/2/actions/file_list/execute/?page=1&page_size=2' \
-H 'accept: application/json' \
-H 'authorization: Basic YWRtaW46ajRrVEdDVHNaMg==' \
-H 'X-CSRFToken: ZNvziEHo7ZoUBQXFLvi7ZdsqUao4C0ttgpEkVsxaNOSqRPYPRbXY0mF73rM4GnbH'
Here is what the swagger says the response should look like :
{
count* integer
next string($uri)
previous string($uri)
results* []
}
And here is the actual response of Mayan :
[
{
"encoded_filename": "MTAwYmY5MmItODA4Yi00ODhhLWI4Y2UtYzhkZDNhNWU3Nzc3LmpwZw%3D%3D",
"filename": "100bf92b-808b-488a-b8ce-c8dd3a5e7777.jpg",
"size": 3833220
},
{
"encoded_filename": "MjAwYmY5MmItODA4Yi00ODhhLWI4Y2UtYzhkZDNhNWU4ODg4LmpwZw%3D%3D",
"filename": "200bf92b-808b-488a-b8ce-c8dd3a5e8888.jpg",
"size": 79153
},
{
"encoded_filename": "MDAwYmY5MmItODA4Yi00ODhhLWI4Y2UtYzhkZDNhNWU0NjVlLnBuZw%3D%3D",
"filename": "000bf92b-808b-488a-b8ce-c8dd3a5e465e.png",
"size": 634783
}
]
I have a file list but it does not respect the pagination, and the format is not what is expected.
Am i missing a point ?