Skip to main content

Data Types

RestAPI.com supports several data types for collection properties.

Primitive Types

string

Text values up to 1024 characters.

{ "name": "title", "type": "string" }

JSON format: "Hello World"

integer

Whole numbers from -2,147,483,648 to 2,147,483,647.

{ "name": "quantity", "type": "integer" }

JSON format: 42

decimal

Decimal numbers from -922,337,203,685,477.5808 to 922,337,203,685,477.5807.

{ "name": "price", "type": "decimal" }

JSON format: 29.99 (use period as separator)

boolean

True or false values.

{ "name": "isActive", "type": "boolean" }

JSON format: true or false

date

Date-only values from January 1, 1753 to December 31, 9999.

{ "name": "birthDate", "type": "date" }

JSON format: "2024-01-15"

date-time

Date and time in ISO 8601 format (UTC).

{ "name": "createdAt", "type": "date-time" }

JSON format: "2024-01-15T10:30:00Z"

note

DateTime values are stored in UTC. Values without timezone indicators are treated as UTC.

guid

Globally unique identifier (128-bit UUID).

{ "name": "externalId", "type": "guid" }

JSON format: "f38fa478-842e-4599-8cbc-918a34b3b789"

Format: 8-4-4-4-12 hexadecimal characters separated by hyphens.

Complex Types

blob

Binary large object for file storage.

{ "name": "image", "type": "blob" }

Upload via POST with multipart/form-data. See Working with BLOBs.

object

Arbitrary JSON structure for flexible, schema-less data.

{ "name": "metadata", "type": "object" }

JSON format: Any valid JSON object or array:

{
"metadata": {
"tags": ["featured", "sale"],
"dimensions": { "width": 100, "height": 200 }
}
}
note

Use object when you need flexible structures. For typed relationships between collections, use lookups instead.

Lookups

Reference to an item in another collection. Set typeName to the target collection name.

{ "name": "customer", "typeName": "customers" }

JSON format: { "id": "customer-guid-here" }

When reading data, lookups return the referenced item's display property along with the ID.

JSON Formatting Rules

TypeRequires QuotesExample
stringYes"Hello"
integerNo42
decimalNo29.99
booleanNotrue
dateYes"2024-01-15"
date-timeYes"2024-01-15T10:30:00Z"
guidYes"f38fa478-..."
objectObject{ "key": "value" }
LookupObject{ "id": "..." }

Type Validation

Invalid types in requests return 400 Bad Request:

{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid value for property 'price': expected decimal"
}
}