|
1 |
| -# epilotapi |
| 1 | +# Epilot Python SDK |
| 2 | + |
| 3 | +Epilot is the digital foundation for sales, service, network and implementation processes in the context of the energy transition. This SDK is for the Epilot Journey, Entity and Automation APIs. Please see the Epilot developer documentation for more information. |
2 | 4 |
|
3 | 5 | <!-- Start SDK Installation -->
|
4 | 6 | ## SDK Installation
|
5 | 7 |
|
6 | 8 | ```bash
|
7 | 9 | pip install epilotapi
|
8 | 10 | ```
|
| 11 | + |
| 12 | +## Authentication |
| 13 | + |
| 14 | +To call epilot APIs, requests must be authorized using a valid Access Token. |
| 15 | + |
| 16 | +### Using Access Token Authorization |
| 17 | +The access token should be passed in the Authorization request header. |
| 18 | + |
| 19 | +```bash |
| 20 | +Authorization: Bearer <your-access-token> |
| 21 | +``` |
| 22 | + |
| 23 | +### Creating Access Tokens |
| 24 | +Users logged into the epilot 360 portal can manage their Access Tokens from Settings > Access Tokens. |
| 25 | + |
| 26 | +Creating access tokens requires the `token:create` permission. |
| 27 | + |
| 28 | +Access Token API |
| 29 | +Authenticated users can generate long-term access tokens for 3rd party applications using the epilot Access Token API createAccessToken operation. |
| 30 | + |
| 31 | +```bash |
| 32 | +POST /v1/access-tokens |
| 33 | +{ |
| 34 | + "name": "Token for my application" |
| 35 | +} |
| 36 | +``` |
| 37 | +Optionally, you can pass a list of Role IDs, to define the roles the access token will have access to. By default, the access token inherits the caller's roles. |
| 38 | + |
| 39 | +```bash |
| 40 | +POST /v1/access-tokens |
| 41 | +{ |
| 42 | + "name": "Postman Access Token", |
| 43 | + "assume_roles": ["123:owner"] |
| 44 | +} |
| 45 | +``` |
| 46 | +Each Access Token generated via the API gets a generated a unique ID. |
| 47 | + |
| 48 | +```bash |
| 49 | +// 201 - success |
| 50 | +{ |
| 51 | + "id": "api_5ZugdRXasLfWBypHi93Fk", |
| 52 | + "created_at": "2019-08-24T14:15:22Z", |
| 53 | + "name": "Postman Access Token", |
| 54 | + "assignments": ["123:owner"] |
| 55 | +} |
| 56 | +``` |
| 57 | +Access tokens may also be revoked using the revokeAccessToken operation |
| 58 | +```bash |
| 59 | +DELETE /v1/access-tokens/api_5ZugdRXasLfWBypHi93Fk |
| 60 | +// 200 - success |
| 61 | +{ |
| 62 | + "id": "api_5ZugdRXasLfWBypHi93Fk", |
| 63 | + "created_at": "2019-08-24T14:15:22Z", |
| 64 | + "name": "Postman Access Token", |
| 65 | + "assignments": ["123:owner"] |
| 66 | +} |
| 67 | +``` |
| 68 | + |
9 | 69 | <!-- End SDK Installation -->
|
10 | 70 |
|
11 | 71 | ## SDK Example Usage
|
|
0 commit comments