Storeden Developers

Template API

Current version: v1.1 Release Candidate

List shop snippet

GET
/template/js.json
List shop snippet Request

$storeden = new Storeden\Storeden($config);

$snippet_list = $storeden->get('/template/js.json');
					
List shop snippet Response

[
  {
    "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"
  }
]
						

Create new shop snippet

POST
/template/js.json
PARAMETERS LIST
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)
Create new shop snippet request

$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);
					
Create new shop snippet response

{
  "script_id": "56d7093d16f46a7f5a9bd2a3"
}
						

Remove shop snippet

DELETE
/template/js.json
PARAMETERS LIST
id required (StoredenId) Your snippet id.
This action delete permanently the snippet and is not possible to recover data.
Remove shop snippet request

$storeden = new Storeden\Storeden($config);

$payload = array();
$payload['id'] = '56d7093d16f46a7f5a9bd2a3';

$snippet_operation = $storeden->delete('/template/js.json', $payload);
					
Remove shop snippet response

{
	"ok": 1,
	"err": null
}
					

Upload template package

POST
/template/package.json
PARAMETERS LIST
file required (file-stream) Template must be compatible with Storeden Template Engine
This API is restricted only for Storeden4Partner property shop.
Upload template package request

$storeden = new Storeden\Storeden($config);

$template_upload = $api->upload('/template/package.json', '/tmp/theme.zip');
					
Upload template package response

{
	"upload": "completed"
}