1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
# Public API of the Belenios web server
Logged in administrators can get an "administrator" API token at
`/api-token`. This token expires when the administrator logs out, or
after 24 hours (or when the server is restarted).
For each draft, a token is generated for the credential authority. It
is embedded in the link sent by the administrator to the credential
authority.
The token (of the administrator or of the credential authority) must
be given in an HTTP header:
Authorization: Bearer $API_TOKEN
An HTTP error 401 (Unauthorized) is returned when the token is
invalid.
The root of the API is at `/api/`. All endpoints below are relative to
this root.
`PUT`, `POST` and `DELETE` requests support the `If-Match` header: if
present, it must be the SHA256-Base64Compact of what would be returned
by a `GET` request (if supported) on the same endpoint. This is
typically used to avoid silent conflicts. An HTTP error 412
(Precondition Failed) is returned when there is no match.
# Endpoints
Here, we give for each endpoint the available methods and their
types. They refer to types defined in `src/common/api/serializable.atd`.
## `configuration` (anybody)
### `GET`: unit -> configuration
## `account` (administrator)
### `GET`: unit -> api_account
### `PUT`: api_account -> unit
## `drafts` (administrator)
### `GET`: unit -> summary_list
### `POST`: draft -> uuid
## `drafts/$UUID`
### `GET`: unit -> draft (anybody)
### `PUT`: draft -> unit (administrator)
### `POST`: draft_request -> unit (administrator)
### `DELETE`: unit -> unit (administrator)
## `drafts/$UUID/election` (anybody)
### `GET`: unit -> json
## `drafts/$UUID/voters`
### `GET`: unit -> voter_list (administrator or credential authority)
### `PUT`: voter_list -> unit (administrator)
### `POST`: voters_request -> unit (administrator)
## `drafts/$UUID/passwords` (administrator)
### `GET`: unit -> string_list
### `POST`: string_list -> unit
## `drafts/$UUID/credentials/token` (administrator)
### `GET`: unit -> string
## `drafts/$UUID/credentials/public`
### `GET`: unit -> public_credentials (anybody)
### `POST`: public_credentials -> unit (credential authority)
## `drafts/$UUID/credentials/private` (administrator)
### `GET`: unit -> private_credentials
## `drafts/$UUID/trustee` (trustee)
### `GET`: unit -> trustee_status
### `POST`: json -> unit
## `drafts/$UUID/trustees`
### `GET`: unit -> draft_trustees (administrator or nobody)
### `POST`: trustees_request -> unit (administrator)
## `drafts/$UUID/trustees/$ADDRESS` (administrator)
### `DELETE`: unit -> unit
## `drafts/$UUID/status` (administrator)
### `GET`: unit -> draft_status
## `elections` (administrator)
### `GET`: unit -> summary_list
## `elections/$UUID`
### `GET`: unit -> election_status (anybody)
### `POST`: admin_request -> unit (administrator)
### `DELETE`: unit -> unit (administrator)
## `elections/$UUID/audit-cache` (anybody)
### `GET`: unit -> audit_cache
## `elections/$UUID/election` (anybody)
### `GET`: unit -> json
## `elections/$UUID/archive` (anybody)
### `GET`: unit -> bel
## `elections/$UUID/salts/$INDEX` (anybody)
### `GET` : unit -> 'a salt
## `elections/$UUID/trustees` (anybody)
### `GET`: unit -> 'a trustees
## `elections/$UUID/automatic-dates`
### `GET`: unit -> election_auto_dates
### `PUT`: election_auto_dates -> unit (administrator)
## `elections/$UUID/voters` (administrator)
### `GET`: unit -> voter_list
## `elections/$UUID/records` (administrator)
### `GET`: unit -> records
## `elections/$UUID/trustee` (trustee)
### `GET`: unit -> tally_trustee
### `POST`: json -> unit
## `elections/$UUID/nh-ciphertexts` (anybody)
### `GET`: unit -> 'a nh_ciphertexts
## `elections/$UUID/encrypted-tally` (anybody)
### `GET`: unit -> 'a encrypted_tally
## `elections/$UUID/shuffles` (administrator)
### `GET`: unit -> shuffles
## `elections/$UUID/shuffles/$ADDRESS` (administrator)
### `POST`: shuffler_request -> unit
## `elections/$UUID/partial-decryptions`
### `GET`: unit -> partial_decryptions (administrator)
## `elections/$UUID/objects/$HASH` (anybody)
### `GET`: unit -> json
## `elections/$UUID/last-event` (anybody)
### `GET`: unit -> last_event
## `elections/$UUID/roots` (anybody)
### `GET`: unit -> roots
## `elections/$UUID/ballots`
### `GET`: unit -> ballots_with_weights (anybody)
### `POST`: ballot -> unit (voter)
Experimental!
Voters using this endpoint must use a Base64-encoded JSON structure as
API token. The structure depends on the authentication mode (only
dummy and password are supported at the moment).
|