iosswiftazureazure-mobile-services

Increasing fetchLimit and sorting results when using readWithQueryString Azure's call


I need to query some data from my Azure Mobile Service. What I know so far is that I use the MSQuery call I can change the fetchLimit and orderBy but not add the systemProperties in the returned data. When using readWithQueryString I have been able to fetch those systemProperties but not to change the fetch limit nor sort results.

Im guessing you can add some more query-parameters when using readWithQueryString but I havent found any information of how to do such a thing.

Im working on an IOS app using swift in XCode.

This is using a class that allows you fetch the systemProperties I havent been able to add an orderBy and fetchLimit change to the URL:

itemTable.readWithQueryString("https://mymobileService.azure-mobile.net/tables/tableName?__systemProperties=createdAt") 

And this would be using a query class that doesn't allow you to get the systemProperties:

var query = itemTable.query()
query.fetchLimit = 300
query.orderByDescending("__createdAt")

Solution

  • After trying so many things I got it to work like this:

    itemTable.readWithQueryString("https://serviceName.azure-mobile.net/tables/TableName?__systemProperties=createdAt&$top=100&$orderby=__createdAt%20desc")
    

    I pretty much had to guess since there is not much documentation for this on Azure.