Constants
Data Types
| Name | Example | Description |
|---|---|---|
| integer | 1, 1000, -50 | Rounded integral number |
| float | 100.00 | Floating point value |
| string | "hello", "I am Enstore" | String value, maximum 500 characters unless specified otherwise. No newline characters allowed unless it makes sense. |
| limited string | "this-is-a-slug" | String limited by length or allowed characters |
| special string | "ef34ac23a3e111dea9736dd313f51ffc", "tags:bike" | String with specific format |
Data Format
Enstore supports different data formats for text data and binary data (like images). The Enstore API uses UTF-8 encoding for text and prefers UNIX-style LF (U+000A) linebreaks.
JSON
JSON, short for JavaScript Object Notation is a lightweight computer data interchange format. It is a text-based, human-readable format for representing simple data structures and associative arrays (called objects). The JSON format is often used for serialization and transmitting structured data over a network connection. Its main application is in Ajax web application programming, where it serves as an alternative to the XML format.
You can learn more about JSON at the Wikipedia page, or at it's official homepage. There are JSON implementations available in many languages, and you can check syntax with JSON Lint.
| Data Type | Example Encoding |
|---|---|
| integer | 100 |
| string | "I am Enstore" |
| float | 100.00 |
| array | [1, 2, 3] |
| dictionary | {"key": "value"} |
Because JSON only supports primitive data types by default, Enstore handles more advanced data types by expressing them in simple data types.
| Data Type | Example Encoding | Notes |
|---|---|---|
| decimal | "100.33" | Precise number expressed in string |
| datetime | 1253230487 | Standard UTC UNIX timestamp expressed as integer, precision up to seconds |
JSONP
JSONP (or padded-JSON) is a format that makes it possible to use it through ajax directly in a web browser, even if the request is cross domain. The only difference in formatting is that the data is wrapped in a callback function for security. By default this is callback, but it can be set by setting the GET callback variable in a request. For example: GET /[store-handle]/api/v2/products.jsonp?callback=customFunction.
Images
Enstore supports the most popular image formats on the web. Image formats are detected based on their extension. All extensions will be converted to lower case.
| Extension | Mime Type | Notes |
|---|---|---|
| jpg | image/jpeg | jpeg is also supported, but will be converted to jpg |
| gif | image/gif | |
| png | image/png | |
| application/pdf | Beware that not all browsers can display inline pdf images |