Personyze Personyze developer docs
Open Personyze
REST API

REST request path parameters

The where / order_by / limit / columns syntax shared by every object.

Personyze developer documentation Questions: support@personyze.com

The URL for REST API is

app.personyze.com/rest/{OBJECT}

Path parameters can be added to the request to select records by condition and sort the result.

Select by record Id

If the first parameter is number, like in app.personyze.com/rest/placeholders/14, this number will be used as record Id. So this request asks for placeholder Id 14.

app.personyze.com/rest/{OBJECT}/{NUMBER}

"Where": Select by other column

It's possible to select by name or by any other available columns. The syntax will be

app.personyze.com/rest/{OBJECT}/where/{COLUMN}={VALUE}

One example:

curl 'https://api:FD09908F25BECB09D78EBEA1DADFB618651F612D@app.personyze.com/rest/placeholders/where/name=Fake'

We put "=" sign between {COLUMN} and {VALUE}, but there are other operations available:

  • = - equals
  • != - doesn't equal
  • > - greater than
  • < - less than
  • >= - greater or equal
  • <= - less or equal
  • : - in comma-list of values
  • !: - not in comma-list of values

For several conditions that all must be met, use & ("and" operator).

app.personyze.com/rest/{OBJECT}/where/{COLUMN1}={VALUE1}&{COLUMN2}={VALUE2}&...

For several conditions that at least one of them must be met, use | ("or" operator).

app.personyze.com/rest/{OBJECT}/where/{COLUMN1}={VALUE1}|{COLUMN2}={VALUE2}|...

And you can combine both. "And" operator has higher precedence than "or", like multiplication over addition in algebra. Parentheses are not supported.

Special characters in a value

A value is percent-encoded as in any URL path: %40 for @, %20 for a space, %25 for %. The characters that structure the path - /, |, &, , and the operators - are read as structure where they appear as they are, and as part of the value where they appear encoded:

app.personyze.com/rest/users/where/first_name:Ann,Bob        first_name is Ann or Bob
app.personyze.com/rest/users/where/first_name=Ann%2C%20Bob   first_name is "Ann, Bob"
app.personyze.com/rest/users/where/email=ann%40example.com

A + is a plus sign, not a space (john+news@example.com is found as written). A number column takes numbers only: id:10%2C20 (one value, "10,20") answers 400 rather than being compared as 10.

Being introduced. Until these rules are switched on, requests keep their earlier reading: an encoded ,, & or | still separates values the way a plain one does, and a number column compared with text is still answered (the database reads the text's leading digits, or 0). To get the same answer before and after, encode only data, send the separators as they are, and give number columns numbers.

"Order_by": Sort the result

app.personyze.com/rest/{OBJECT}/order_by/{COLUMN},{COLUMN},...

The resulting records will be sorted in ascending order by one or several columns.

app.personyze.com/rest/{OBJECT}/order_by_desc/{COLUMN},{COLUMN},...

In descending order.

"Limit": How many records to get

app.personyze.com/rest/{OBJECT}/limit/{LIMIT}

After sorting you may want to get top several records.

app.personyze.com/rest/{OBJECT}/limit/{OFFSET},{LIMIT}

Skip {OFFSET} records, then get {LIMIT} records. So it's possible to implement pagination.

"Skip": Where the page starts

app.personyze.com/rest/{OBJECT}/limit/{LIMIT}/skip/{OFFSET}

Equivalent to limit/{OFFSET},{LIMIT}. skip and limit can appear in either order, and offset is accepted as a synonym of skip.

"Columns": Get only specific columns for each record

app.personyze.com/rest/{OBJECT}/columns/{COLUMN1},{COLUMN2},...

Without "columns", API returns all available columns for given object.

"Column": Get only one specific column

app.personyze.com/rest/{OBJECT}/column/{COLUMN}

This changes format of resulting JSON value. The result will be 1-dimensional array of values of the given column. Normally (without "column") it's array of JSON objects.