Parameters types in the Typekit API

Most Typekit API endpoints require some parameters to be sent as part of the request.

All parameters are passed in the usual application/x-www-form-urlencoded format specified by the W3c HTML 4 specification. For example, name1=one&name2=two.

Most parameters are simple strings, but some endpoints require other types to be provided.

Object List Parameters

Object list parameters represent an ordered list of objects containing key/value pairs.

They are passed using PHP/Rails style nested hash parameters. For example families[0][id]=gkmg&families[0][subset]=default&families[1][id]=asdf describes a list of two objects, the first with the keys id and subset, and the second with just the key id.

Values in each object may be any of the other parameter types (list parameters, integers, booleans, or just plain strings) depending on the context.

Many languages make it easy to generate this type of parameter from native objects, such as http_build_query in PHP and Rack::Utils.build_nested_query in Ruby.

List Parameters

List parameters can be passed in two ways:

  • The list can be joined together with a comma (U+002C) and sent as a single parameter. For example domains=example.com,example.net
  • Multiple parameters can be sent using PHP/Rails style list parameters, each containing a single value. To use this style, add '[]' after the name of each parameter. For example domains[]=example.com&domains[]=example.net

Integers

Integers are passed as decimal strings. For example page=12.

Booleans

Booleans are passed using the strings true and false.