Please send your apiKey as a header value under the key x-api-key
GET https://db.EonaCat.com/_databases
Resp:
200/OK
[
"test"
]
POST https://db.EonaCat.com/test
Data:
{
"Name": "person",
"PrimaryKey": "person_id",
"Columns": [
{
"Name": "person_id",
"Type": "int",
"Nullable": false
},
{
"Name": "first_name",
"Type": "nvarchar",
"MaxLength": 32,
"Nullable": false
},
{
"Name": "last_name",
"Type": "nvarchar",
"MaxLength": 32,
"Nullable": true
},
{
"Name": "age",
"Type": "int",
"Nullable": false
},
{
"Name": "created",
"Type": "datetime",
"Nullable": true
}
]
}
Resp:
201/Created
GET https://db.EonaCat.com/test
Resp:
200/OK
{
"Name": "test",
"Type": "mssql",
"Hostname": "localhost",
"Port": 1433,
"Instance": "sqlexpress",
"Debug": false,
"TableNames": [
"person"
]
}
GET https://db.EonaCat.com/test/person?_describe
Resp:
200/OK
{
"Name": "person",
"PrimaryKey": "person_id",
"Columns": [
{
"Name": "person_id",
"Type": "int",
"Nullable": false
},
{
"Name": "first_name",
"Type": "nvarchar",
"MaxLength": 32,
"Nullable": false
},
{
"Name": "last_name",
"Type": "nvarchar",
"MaxLength": 32,
"Nullable": true
},
{
"Name": "age",
"Type": "int",
"Nullable": false
},
{
"Name": "created",
"Type": "datetime",
"Nullable": true
}
]
}
Be sure to use timestamps appropriate to your database type, for instance:
POST https://db.EonaCat.com/test/person
Data: { first_name: 'John', last_name: 'Doe', age: 36, created: '2022-07-27' }
Resp:
201/Created
{
"person_id": 1,
"first_name": "John",
"last_name": "Doe",
"age": 36,
"created": "2022-07-27 00:00:00"
}
To create multiple objects, send a JSON array containing a series of dictionaries appropriate for the specified table.
POST https://db.EonaCat.com/test/person?_multiple
Data: [ { first_name: 'John', last_name: 'Doe', age: 36, created '2022-07-27' }, ... ]
Resp:
201/Created
You can retrieve all of a table's contents, retrieve by a specific ID, and filter by key-value pairs (using the querystring).
GET https://db.EonaCat.com/test/person
GET https://db.EonaCat.com/test/person/1
GET https://db.EonaCat.com/test/person?first_name=John
Resp:
200/OK
[
{
"person_id": 1,
"first_name": "John",
"last_name": "Doe",
"age": 36,
"created": "2022-07-27T00:00:00Z"
},
{ ... }
]
You can retrieve results and use pagination to return only a subset. Include _index, _max, _order, and _order_by in the querystring.
_index
is the starting index
_max is the maximum number of results to retrieve_order must be either asc (ascending) or desc (descending)._order_by is one or more column names in a comma-separated list.By default, SELECT requests are ordered ASCENDING by the table's primary key.
GET https://db.EonaCat.com/test/person?_max=1&_index=1&_order=asc&_order_by=person_id,first_name
Resp:
200/OK
[
{
"__row_num__": 1,
"person_id": 1,
"first_name": "John",
"last_name": "Doe",
"age": 36,
"created": "2022-07-27 00:00:00"
},
{ ... }
]
Supply the ID in the URL and include the key-value pairs to change in the request body.
PUT https://db.EonaCat.com/test/person/1
Data: { age: 38 }
Resp:
200/OK
{
"person_id": 1,
"first_name": "John",
"last_name": "Doe",
"age": 38,
"created": "2022-07-27 00:00:00"
}
PUT https://db.EonaCat.com/test/person
Data:
{
"Left": "person_id",
"Operator": "GreaterThan",
"Right": 0
}
Resp:
200/OK
[
{
"person_id": 1,
"first_name": "John",
"last_name": "Doe",
"age": 38,
"created": "2022-07-27 00:00:00"
}
]
DELETE https://db.EonaCat.com/test/person/1
Resp:
204/Deleted
DELETE https://db.EonaCat.com/test/person?_truncate
Resp:
204/Deleted
DELETE https://db.EonaCat.com/test/person?_drop
Resp:
204/Deleted
POST https://db.EonaCat.com/test?raw
Data:
SELECT * FROM person;
Resp:
200/OK
[
{
"person_id": 1,
"first_name": "John",
"last_name": "Doe",
"age": 38,
"created": "2022-07-27 00:00:00"
}
]