Schema provides a full set of ecommerce models and functionality that can be quickly customized and adapted to any business requirement. Each feature has an API that can be called in any programming language from any server in the world.
The following documentation is intended for developers with at least a basic understanding of the web and database terminology.
Start by retrieving your API key from Admin > Settings > Overview > API Keys. If you don't have one yet, create a free account now.
Install an API client or framework. Schema offers several interfaces for popular programming languages:
- PHP API Client
- PHP Template Framework
- NodeJS API Client
- Python API Client
- Ruby API Client
- Java API Client
require('/path/to/schema-php-client/lib/Schema.php');
$client = new \Schema\Client('<client-id>', '<client-key>');
var Schema = require('schema-client')
var client = new Schema.Client('<client-id>', '<client-key>');
import schema
client = new schema.client({'id': '<client-id>', 'key': '<client-key>'});
require 'schema'
client = Schema::Client.new({'id': '<client-id>', 'key': '<client-key>'});
Common usage patterns for quick reference
// Get a record by ID
$record = $client->get('/products/{id}', array(
'id' => '...'
));
// Get a collection of records with field criteria
$records = $client->get('/products', array(
'active' => true
));
// Loop over a collection of records
foreach ($records as $record) {
// Access a simple field
$record['id']; // 553ee8a352279905269c60eb
// Access a link field
$record['categories']; // Array(...)
}
// Update a record by ID
$result = $client->put('/products/{id}', array(
'id' => '...',
'active' => true
));
// Create a new record
$result = $client->post('/products', array(
'name' => 'New Product',
'sku' => 'T1000',
'active' => true
));
// Delete a record by ID
$result = $client->delete('/products/{id}', array(
'id' => '...'
));
// Get a record by ID
client.get('/products/{id}', {
id: '...'
}, function(record) {
...
});
// Get a collection of records with field criteria
client.get('/products', {
active: true
}, function(records) {
...
});
// Loop over a collection of records
records.each(function(record) {
// Access a simple field
record.id; // 553ee8a352279905269c60eb
// Access a link field
record.categories(function(results) {
...
});
});
// Update a record by ID
client.put('/products/{id}', {
id: '...',
active: true
}, function(result) {
...
});
// Create a new record
client.post('/products', {
name: 'New Product',
sku: 'T1000',
active: true
}, function(result) {
...
});
client.delete('/products/{id}', {
id: '...'
}, function(result) {
...
});
Note: Each NodeJS client method also returns a Promise.
client.get('/products')
.then(function(result) {
...
});