EDB Postgres Enterprise Manager REST APIs v1.0.0 v10.2

EDB Postgres Enterprise Manager uses a token-based authentication mechanism to allow access to exposed REST APIs.

PEM uses tokens for authentication purposes. To generate a token, please refer the section Token. After receiving a token string, you should include the token string in the 'X-Auth-Token' header when calling any resources except https://PEM-SERVER-IP/api/token/.

NOTE:

  • EDB Postgres Enterprise Manager is referred as PEM in this documentation.
  • PEM *uses self-certified SSL certificates, so you may encounter errors such as 'SSL certificate problem: self signed certificate'. You may need to use an 'insecure' connection to connect to the server.

Rest api versions:

Base URLs:

Email: EnterpriseDB Web: EnterpriseDB License: Limited Use Software License Agreement

Token

A string generated and used by PEM REST APIs for authentication purposes

TokenGeneration

Code samples

# You can also use wget
curl -X POST https://PEM-SERVER-IP/api/token/ \
 -H 'Content-Type: application/json' \
 -H 'Accept: application/json'
import requests
headers = {
 'Content-Type': 'application/json',
 'Accept': 'application/json'
}
r = requests.post('https://PEM-SERVER-IP/api/token/', headers = headers)
print(r.json())
const inputBody = '{
 "username": "string",
 "password": "string"
}';
const headers = {
 'Content-Type':'application/json',
 'Accept':'application/json'
};
fetch('https://PEM-SERVER-IP/api/token/',
{
 method: 'POST',
 body: inputBody,
 headers: headers
})
.then(function(res) {
 return res.json();
}).then(function(body) {
 console.log(body);
});

POST /token/

Generate a token for authentication.

This URL creates a token to be used by the other REST APIs exposed by PEM. You must provide a valid username and password, which will be validated during the process.

The token will be valid for 20 mins.

Body parameter

{
 "username": "string",
 "password": "string"
}

Parameters

NameInTypeRequiredDescription
bodybodyobjecttrueCreates the token using the /token/ URL first.
» usernamebodystringtrueValidates username, which has pem_user role.
» passwordbodystringtruePassword for the username

Example responses

201 Response
{
 "issuedAt": "2019年08月24日T14:15:22Z",
 "expiresAt": "2019年08月24日T14:15:22Z",
 "schema_version": 0,
 "backend_schema_version": 0,
 "version_long": 0,
 "version": "string",
 "supported_api_versions": [
 "string"
 ],
 "deprecated_api_versions": [
 "string"
 ]
}

Responses

StatusMeaningDescriptionSchema
201Created Token was created and can be found as 'X-Subject-Token' in the response header.Inline
401Unauthorized The given information is not valid.None
500Internal Server Error Something went wrong.None
503Service Unavailable PEM backend database server is down. Service is not available now.None

Response Schema

Status Code 201

Contains information related to when the token was generated and when it expired.

NameTypeRequiredRestrictionsDescription
» issuedAtstring(date-time)falsenoneToken was generated at this time.
» expiresAtstring(date-time)falsenoneProvides date and time when the token expires.
» schema_versionintegerfalsenoneApplication-supported schema version
» backend_schema_versionintegerfalsenoneBackend database schema version
» version_longintegerfalsenoneVersion represented in long format
» versionstringfalsenoneString reprentation of the PEM version
» supported_api_versions[string]falsenoneList of supported API versions
» deprecated_api_versions[string]falsenoneList of deprecated API versions

Response Headers

StatusHeaderTypeFormatDescription
201X-Subject-TokenstringReturns the new token, which can be used with REST APIs for further operations
Info

This operation does not require authentication

delete__token_

Code samples

# You can also use wget
curl -X DELETE https://PEM-SERVER-IP/api/token/ \
 -H 'X-Auth-Token: string'
import requests
headers = {
 'X-Auth-Token': 'string'
}
r = requests.delete('https://PEM-SERVER-IP/api/token/', headers = headers)
print(r.json())
const headers = {
 'X-Auth-Token':'string'
};
fetch('https://PEM-SERVER-IP/api/token/',
{
 method: 'DELETE',
 headers: headers
})
.then(function(res) {
 return res.json();
}).then(function(body) {
 console.log(body);
});

DELETE /token/

Release the token.

Invalidates the token. It will no longer be available for further operations.

Parameters

NameInTypeRequiredDescription
X-Auth-TokenheaderstringtrueToken of authorization

Example responses

Responses

StatusMeaningDescriptionSchema
204No Content Successfully released the token from PEM.
This token can not be used for any further operations.None

Response Schema

Info

This operation does not require authentication