digitaldemocratic/docs/integrations.md

1.4 KiB

Integrations

The dd can be integrated with other systems using their APIs.

Autentication

All requests must be authenticated with a Json Web Token (JWT), and must be signed with the API_SECRET (defined in dd.conf).

This authentication is done with the Authentication http header.

Read details ```sh > curl -H "Authorization: bearer ${jwt}" https://admin.DOMAIN/ddapi/roles [ { "keycloak_id": "9325ad99-7e04-4c31-9768-5512e1564160", "id": "admin", "name": "admin", "description": "${role_admin}" }, { "keycloak_id": "c6c8a73e-51fc-4716-831d-1dfc0e0b62b0", "id": "manager", "name": "manager", "description": "Realm managers" }, { "keycloak_id": "24d7977e-da83-4591-8e13-0fac3126afa1", "id": "student", "name": "student", "description": "Realm students" }, { "keycloak_id": "d6699c41-13d5-4623-bdca-e5f2775474ed", "id": "teacher", "name": "teacher", "description": "Realm teachers" } ] ```

Where JWT can be generated, e.g. using python-jose:

import os
from jose import jws
t = jws.sign({}, os.environ["API_SECRET"], algorithm="HS256")
print(t)

Other programming languages have similar ways of generating tokens.

API Notable

Projecte NotaBLE

!!swagger ddapi.json!!