thebenman
thebenman

Reputation: 1621

odata.nextLink is not part of the response

I'm following this tuorial to set up implement paging using odata v3 in asp.net web api 2

The generated odata controller method

public class Level2TableController : ODataController
    {
        private ProvisioningDMEntities db = new ProvisioningDMEntities();

        // GET: odata/Level2Table
        [EnableQuery(PageSize=10)]
        public IQueryable<Level2tableAllBudgets> GetLevel2Table()
        {
            return db.Level2tableAllBudgets.AsQueryable();
        }
}

and when I call the link like api/Level2Table?$top=5&$inlinecount=allpages I get a odata response which doesn't include the nextPage Link

enter image description here

I tried all the options like setting the accept header to odata=verbose but it still doesn't return.

How do I get the nextPage link included as part of the response?

Upvotes: 0

Views: 2294

Answers (1)

GWigWam
GWigWam

Reputation: 2124

If you include $top=<nr> in your request OData will not supply a nextPage link.

Modify your request as follows:

HTTP GET api/Level2Table?$inlinecount=allpages

The service will return 10 entries in your case because that is the PageSize you set.

Upvotes: 1

Related Questions