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
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | true | Creates the token using the /token/ URL first. |
» username | body | string | true | Validates username, which has pem_user role. |
» password | body | string | true | Password for the username |
Example responses
201 Response
{ "issuedAt": "2019-08-24T14:15:22Z", "expiresAt": "2019-08-24T14:15:22Z", "schema_version": 0, "backend_schema_version": 0, "version_long": 0, "version": "string", "supported_api_versions": [ "string" ], "deprecated_api_versions": [ "string" ] }
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | Token was created and can be found as 'X-Subject-Token' in the response header. | Inline |
401 | Unauthorized | The given information is not valid. | None |
500 | Internal Server Error | Something went wrong. | None |
503 | Service 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.
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» issuedAt | string(date-time) | false | none | Token was generated at this time. |
» expiresAt | string(date-time) | false | none | Provides date and time when the token expires. |
» schema_version | integer | false | none | Application-supported schema version |
» backend_schema_version | integer | false | none | Backend database schema version |
» version_long | integer | false | none | Version represented in long format |
» version | string | false | none | String reprentation of the PEM version |
» supported_api_versions | [string] | false | none | List of supported API versions |
» deprecated_api_versions | [string] | false | none | List of deprecated API versions |
Response Headers
Status | Header | Type | Format | Description |
---|---|---|---|---|
201 | X-Subject-Token | string | Returns 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
Name | In | Type | Required | Description |
---|---|---|---|---|
X-Auth-Token | header | string | true | Token of authorization |
Example responses
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
204 | No 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
- On this page
- Token