Direct Decisions v1 REST API (0.1.0)

Download OpenAPI specification:Download

Direct Decisions REST API provides the core Direct Decisions functionalities over HTTP.

It covers creating votings, changing choices and deleting votings, submitting ballots for voting, re-voting, removing votes and calculating the results of the voting. All operations can be done independently. There are no voting stages and all operations can be done at any time. All voting restrictions are left for the client to impose.

Create a new voting.

Authorizations:
Bearer
Request Body schema: application/json
choices
Array of strings (Choices) <= 1000 items [ items <= 1000 characters ]

A list of choices in a particular order.

Responses

Request samples

Content type
application/json
{
  • "choices": [
    ]
}

Response samples

Content type
application/json
{
  • "id": "f6291725fcaf4e2bd399",
  • "choices": [
    ]
}

Get voting information.

Authorizations:
Bearer
path Parameters
voting-id
required
string (VotingID) ^[a-f0-9]{20}$
Example: f6291725fcaf4e2bd399

Responses

Response samples

Content type
application/json
{
  • "id": "f6291725fcaf4e2bd399",
  • "choices": [
    ]
}

Delete a voting.

Authorizations:
Bearer
path Parameters
voting-id
required
string (VotingID) ^[a-f0-9]{20}$
Example: f6291725fcaf4e2bd399

Responses

Response samples

Content type
application/json
{
  • "code": 200,
  • "message": "OK"
}

Add, remove or move a choice in the voting choices list.

This endpoint combines all possible modifications of the choices list elements.

To add a new choice, provide its value as a string and an index where it should be placed in the list. For example, index 0 will append a new choice, while index equal to the number of choices will prepend it. For any other index number between, the choice will be inserted at that position.

To remove a choice, provide the exact choice value as the string and set index to -1 value.

To move an existing choice to a new position, provide the exact choice value as the string and its new position as the index.

Authorizations:
Bearer
path Parameters
voting-id
required
string (VotingID) ^[a-f0-9]{20}$
Example: f6291725fcaf4e2bd399
Request Body schema: application/json
choice
string
index
integer >= -1

0-based position in the choices list.

Responses

Request samples

Content type
application/json
{
  • "choice": "string",
  • "index": -1
}

Response samples

Content type
application/json
{
  • "choices": [
    ]
}

Retrieve an already submitted vote by a voter.

Authorizations:
Bearer
path Parameters
voting-id
required
string (VotingID) ^[a-f0-9]{20}$
Example: f6291725fcaf4e2bd399
voter-id
required
string (VoterID) <= 1000 characters

Responses

Response samples

Content type
application/json
{
  • "ballot": {
    }
}

Submit a vote, in a for of a ballot.

Authorizations:
Bearer
path Parameters
voting-id
required
string (VotingID) ^[a-f0-9]{20}$
Example: f6291725fcaf4e2bd399
voter-id
required
string (VoterID) <= 1000 characters
Request Body schema: application/json
object (Ballot)

Responses

Request samples

Content type
application/json
{
  • "ballot": {
    }
}

Response samples

Content type
application/json
{
  • "revoted": true
}

Remove a submitted vote by a voter.

Authorizations:
Bearer
path Parameters
voting-id
required
string (VotingID) ^[a-f0-9]{20}$
Example: f6291725fcaf4e2bd399
voter-id
required
string (VoterID) <= 1000 characters

Responses

Response samples

Content type
application/json
{
  • "code": 200,
  • "message": "OK"
}

Retrieve a ranked list of choices as they are voted for.

Authorizations:
Bearer
path Parameters
voting-id
required
string (VotingID) ^[a-f0-9]{20}$
Example: f6291725fcaf4e2bd399

Responses

Response samples

Content type
application/json
{
  • "ballot": {
    }
}

Retrieve duels and results of choices as they are voted for.

Duels are pairwise comparisons between choices that can be used to display breakdowns of the voting preferences. The response includes both duels and results to ensure consistency between them.

Authorizations:
Bearer
path Parameters
voting-id
required
string (VotingID) ^[a-f0-9]{20}$
Example: f6291725fcaf4e2bd399

Responses

Response samples

Content type
application/json
{
  • "ballot": {
    }
}