List shop snippet
GET
/template/js.json
GET
/template/js.json
$storeden = new Storeden\Storeden($config);
$snippet_list = $storeden->get('/template/js.json');
[
{
"content": "(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = \"//connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.5\";
fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));",
"name": "Facebook Like Loader",
"id": "56d7093d16f46a7f5a9bd2a3"
}
]
POST
/template/js.json
name required (string) | Name of your asset |
content required (string) | Your script content, will be surrounded with "script" tag |
embed (int) | Surround script with script tag (0) or not (1) |
elaborate (int) July 28th, 2021 | Send (1) if the script contain some data that must be loaded by the template, otherways send empty or (0) |
$storeden = new Storeden\Storeden($config);
$payload = array();
$payload['name'] = 'My New Snippet';
$payload['content'] = 'function mySnippet(){ .... }; mySnippet();';
$payload['embed'] = 0;
$snippet_operation = $storeden->post('/template/js.json', $payload);
{
"script_id": "56d7093d16f46a7f5a9bd2a3"
}
DELETE
/template/js.json
id required (StoredenId) | Your snippet id. This action delete permanently the snippet and is not possible to recover data. |
$storeden = new Storeden\Storeden($config);
$payload = array();
$payload['id'] = '56d7093d16f46a7f5a9bd2a3';
$snippet_operation = $storeden->delete('/template/js.json', $payload);
{
"ok": 1,
"err": null
}
POST
/template/package.json
file required (file-stream) | Template must be compatible with Storeden Template Engine This API is restricted only for Storeden4Partner property shop. |
$storeden = new Storeden\Storeden($config);
$template_upload = $api->upload('/template/package.json', '/tmp/theme.zip');
{
"upload": "completed"
}