Skip to content

Latest commit

 

History

History
48 lines (37 loc) · 925 Bytes

03-data.md

File metadata and controls

48 lines (37 loc) · 925 Bytes

Data Modeling

Schema supports a wide array of options for creating and customizing data models.

Models can be retrieved and updated using the API or Schema Admin interface.

You can use the API to explore standard models.

$product_model = $client->get('/:models/products');

print_r($product_model);
client.get('/:models/products', function(productModel) {
	console.log(productModel);
});

You can use the API to add fields or other properties to standard models.

$client->put('/:models/products', array(
	'fields' => array(
		'my_custom_field' => array(
			'type' => 'string',
			'default' => 'Hello World'
		)
	)
));

print_r($product_model);
client.put('/:models/products', {
	fields: {
		my_custom_field: {
			type: 'string',
			default: 'Hello World'
		}
	}
});

Any property of a model can be modified except id and client_id.