This is my current resource file. I'm using MySQL Query Pagination Feature
<?xml version="1.0" encoding="UTF-8" ?>
<Resource xmlns="http://xml.metamug.net/resource/1.0" v="1.0">
<Request method="GET">
<Query>
select * from tbl_task_master
LIMIT $limit OFFSET $offset
</Query>
</Request>
</Resource>
https://api.metamug.com/checklist/v1.0/task?offset=0&limit=50
It's fetching all the records. I want to paginate and only get a subset. How do I make the request with Metamug.
To implement pagination you need to make use of
limit
andoffset
attributes ofQuery
tag and then you can pass it any parameter name that you'll be using in your request.Let's say your pagination parameters are
l
ando
for limit and offset respectively (though not a good naming convention)Your
resource
file will now look likeUPDATE:
Declaring
Is optional but as you can see we can add more constraints we do initialize them.See this for more on
Param
tag and validation