Olery Developer Portal logo Olery Developer Portal

The API outputs its data using JSON. Attribute names are snake cased (e.g. user_name instead of userName) and are always written in English. Alternative output formats such as XML are not supported.

Most modern languages have built-in support for JSON. For example, both Python and Ruby come with JSON support. In Ruby you can use this as following:

    require 'json'

    encoded = JSON.dump({:number => 10}) # => "{\"number\":10}"
    decoded = JSON.load(encoded)

    decoded # => {"number" => 10}

And in Python:

    import json

    encoded = json.dumps({"number": 10}) # => "{\"number\":10}"
    decoded = json.loads(encoded)

    decoded # => {u"number": 10}

Data Types

The API both accepts and returns data in various types. These type names are based on various classes used in the Ruby programming language. The API only uses a small subset of these types.

The API uses the following types:

String

A text based value encoded using UTF8.

Examples:

"Alice"
"경민"

Fixnum

A 64-bit integer.

Examples:

10
89123809213

Float

A 64-bit floating point number.

Examples:

10.5
2913823.239018239023

Array

A sequence of any type. Arrays can contain multiple types. For example, an Array of String values would be the following:

["Alice", "Bob"]

Or an Array of Fixnums and Strings:

[10, "Alice"]

Hash

A key-value pair (also known as an “object” in JSON). The keys are always String types, the values can be any type (including another Hash).

Example:

{
    "name": "Alice",
    "age": 29
}

And a nested Hash:

{
    "name": "Bob",
    "age": 27,
    "location": {
        "city": "Amsterdam",
        "district": "Jordaan"
    }
}

Date

A date formatted according to ISO 8601. That is, the format is year-month-day with the month and year being zero padded. See Date Formats for more information.

Date types should be submitted (and are returned as) String types. Thus their actual types are Strings, it’s just their format that distinguishes them from regular String values.

Example:

"2014-02-28"

Encoding

API output is always encoded using UTF8 without a Byte Order Mark (BOM). User input should also be encoded using UTF8 or another compatible character encoding.

As our API contains data in various languages (e.g. Russian or Arabic) it’s vital that applications using the API are Unicode aware and can handle UTF8 encoded characters.