- Getting started
- Introduction
- Requirements
- Installation
- Modules
- Collections
- Forms
- Reference
- Configuration
- Fieldtypes
- Docker
- CLI
- Backend Language
- API
- API Token
- Cockpit
- Collections
- Forms
- Singletons
- Webhooks
Cockpit
/api/cockpit/authUser
Authenticate user
fetch('/api/cockpit/authUser?token=xxtokenxx', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
user: 'username',
password: 'xxpasswordxx'
})
})
.then(user => user.json())
.then(user => console.log(user));
/api/cockpit/saveUser
Create / Update user
fetch('/api/cockpit/saveUser?token=xxtokenxx', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
user: {...} // user data (user, name, email, active, group)
})
})
.then(user => user.json())
.then(user => console.log(user));
/api/cockpit/listUsers
Get users.
fetch('/api/cockpit/listUsers?token=xxtokenxx', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
filter: {...}
})
})
.then(users => users.json())
.then(users => console.log(users));
/api/cockpit/assets
Get assets
fetch('/api/cockpit/assets?token=xxtokenxx', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
filter: {...}
})
})
.then(assets => assets.json())
.then(assets => console.log(assets));
/api/cockpit/image
Get thumbnail url
fetch('/api/cockpit/image?token=xxtokenxx', {
method: 'post',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
src: imagePath || asset._id,
m: ('thumbnail' | 'bestFit' | 'resize' | 'fitToWidth' | 'fitToHeight'),
f: (array), // filter name(s), one or more of: 'blur' | 'brighten' | 'colorize' | 'contrast' | 'darken' | 'desaturate' | 'edge detect' | 'emboss' | 'flip' | 'invert' | 'opacity' | 'pixelate' | 'sepia' | 'sharpen' | 'sketch'
w: (int), // width
h: (int), // height
q: (int), // quality
d: (boolean) // include full domain path
b64: (boolean) // return base64 encoded image string
})
})
.then(url => url.text())
.then(url => console.log(url));
<img src="/api/cockpit/image?token=xxtokenxx&src=path&w=200&h=200&f[brighten]=25&o=true" />