Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

 

 

...

Introduction

...

  • pageSize: defines the page dimension of the collection;
  • pageNumber: defines which page to start from;

Currently, filtering Filtering and ordering sorting are supported only in API v1.1 by using the following query string parameters:

...

Tip
titleBest Practices
  • To avoid timeout problems and improve performance, we recommend using pagination and dividing complex processes into smaller and faster ones. This way, the client application is in charge of rebuilding the large data set that would be retrieved from the smaller sets returned by the MailUp system through pagination.
  • URL encoding of the querystring parameters is always recommended. It becomes mandatory when the URL contains characters outside the ASCII set, even if in some cases the method calls can work without it.

 

...

Filtering

Resource filtering is done thanks to a dedicated expression evaluator which is capable of transforming the user provided filter expression into the appropriate SQL statements to query the server database. 
This transformation is achieved in two steps:

...

Supported mathematical and logical operators are:

  • "!", unary "not": returns true if and only if its operand is false
  • "*", Multiply: computes the product of its operands
  • "/", Divide: divides its first operand by its second operand
  • "%", Modulo: computes the remainder after dividing its first operand by its second
  • "+", Add: for numeric types, + computes the sum of its two operands. When one or both operands are of type string, + concatenates the string representations of the operands
  • "-", Subtract: subtract the second operand from the first
  • "<<", binary LeftShift: shifts its first operand left by the number of bits specified by its second operand
  • ">>", binary RightShift: shifts its first operand right by the number of bits specified by its second operand
  • "<", LessThan: returns true if the first operand is less than the second, false otherwise
  • ">", GreaterThan: returns true if the first operand is greater than the second, false otherwise
  • "<=", LessThanOrEqual: returns true if the first operand is less than or equal to the second, false otherwise
  • ">=", GreaterThanOrEqual: returns true if the first operand is greater than or equal to the second, false otherwise
  • "==", Equal: returns true if the values of its operands are equal, false otherwise
  • "!=", NotEqual: returns false if its operands are equal, true otherwise
  • "&", binary And: computes the logical bitwise AND of its operands
  • "^", binary ExclusiveOr: computes the bitwise exclusive-OR of its operands
  • "|", binary Or: computes the bitwise OR of its operands
  • "&&", AndAlso: performs a logical-AND of its bool operands
  • "||", OrElse: performs a logical-OR of its bool operands

TypeRegistry operators

TypeRegistry operators are all the type methods and properties as defined by C# language code definition. For details on method names please refer to msdn online documentation.
Supported type are:

  • "bool", System.Boolean;
  • "byte", System.Byte;
  • "char", System.Char;
  • "int", System.Int32;
  • "decimal", System.Decimal;
  • "double", System.Double;
  • "float", System.Single;
  • "object", System.Object;
  • "string", System.String;
  • "DateTime", System.DateTime;
  • "Convert", System.Convert;
  • "Math", System.Math;

All the supported operators can be mix matched to fulfill the user needs.

...

MethodURIFilter expressionSorting expression
GET/Console/List/{ID_LIST}/Recipients/Subscribed

Email.Contains('mailup.com')

Fields['FirstName'] desc
Resulting URI/Console/List/1/Recipients/Subscribed?filterby="Email.Contains(%27mailup.com%27)"&orderby="Fields%5b%27FirstName%27%5d+desc"


Request for subscribed list recipient whose first name is 'Davide' sorted by 'Email' descending

MethodURIFilter expressionSorting expression
GET/Console/List/{ID_LIST}/Recipients/Subscribed

Fields['FirstName'] == 'Davide'

Email desc
Resulting URI/Console/List/1/Recipients/Subscribed?filterby="Fields%5b%27FirstName%27%5d+%3d%3d+%27Davide%27"&orderby="Email+desc"

 

Request statistics for message views done by recipients whose email contains mailup ordered by view count descending

MethodURIFilter expressionSorting expression
GETMessage/{id_Message}/List/Views

Email.Contains('mailup')

Count desc
Resulting URI/Message/1/List/Views?filterby="Email.Contains(%27mailup%27)"&orderby="Count+desc"

 

Request statistics for message views done by recipients whose email contains mailup, between 2013/01/01 and 2013/01/31 ordered by view count descending

MethodURIFilter expressionSorting expression
GETMessage/{id_Message}/List/Views

Email.Contains('mailup') && [Date >= #2013/01/01# && Date < #2013/01/31#]

Count desc
Resulting URI/Message/1/List/Views?filterby="Email.Contains(%27mailup%27)+%26%26+%5bDate+%3e%3d+%232013%2f01%2f01%23+%26%26+Date+%3c+%232013%2f01%2f31%23%5d"&orderby="Count+desc"

 

Request statistics for message views done by recipients whose email contains mailup, in the last 24 hours ordered by view count descending

MethodURIFilter expressionSorting expression
GETMessage/{id_Message}/List/Views

Email.Contains('mailup') && Date >= DateTime.Now().AddDays(-1)

Count desc
Resulting URI

/Message/1/List/Views?filterby="Email.Contains(%27mailup%27)+%26%26+Date+%3e%3d+DateTime.Now().AddDays(-1)"&orderby="Count+desc"

...

Sorting

Sorting queries define how results should be ordered. Sorting properties are all first level properties as defined in resource service contracts and only in particular cases (ex. recipient custom fields) second level ones can be used.
A sorting query is represented by a string of properties and operands divided by colon (',') and semicolon (';'). Properties that share the same sorting direction can be listed as comma separated values (ex. name, surname desc). When a different sorting direction has to be specified, the new property list must be separated by the others with a semicolon (ex. name, surname desc; email asc).
The way the sorting query is written, determine also the priority of sorting execution, so in case of "name desc; email asc" the results are initially ordered by name descending and then by email ascending.