Skip to content

Commit 73f8380

Browse files
committed
Initial commit
1 parent 0b09208 commit 73f8380

File tree

4 files changed

+564
-3
lines changed

4 files changed

+564
-3
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 Sigbjørn Skjæret
3+
Copyright (c) 2016 Scala Nordic AS
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
1-
# scjs
2-
A simple interface to Scala Content Manager web-services.
1+
# scjs - A simple interface to Scala Content Manager web-services.
2+
3+
This module is loosely modelled after the scws2 Python module, supporting the 2.x REST API.
4+
5+
## Example usage (set DEBUG=scjs for debug output):
6+
7+
```js
8+
scjs = require('scjs');
9+
10+
var baseurl = "http://localhost/ContentManager";
11+
var username = "user";
12+
var password = "pass";
13+
var cm = new scjs.ConManager(baseurl);
14+
cm.login(username, password).then((resp) => {
15+
cm.get('players', { 'limit': 0, 'offset': 0, 'fields': 'id,name,enabled,active,type' }).then((players) => {
16+
console.log(players.list);
17+
});
18+
cm.get('media', { 'limit': 10, 'filters': '{"type":{"values":["IMAGE"]}}' }).then((media) => {
19+
var p = Promise.resolve();
20+
media.list.forEach((item) => {
21+
p = p.then(cm.download(item.downloadPath, item.name));
22+
});
23+
});
24+
cm.upload('LocalFolder/MyPicture.jpg', 'RemoteFolder/MyPicture.jpg').then((item) => {
25+
console.log(item);
26+
});
27+
}).catch((e) => {
28+
console.log(e);
29+
});
30+
```

0 commit comments

Comments
 (0)