This is a deliberation service using majority judgment polling. It's libre software (source) made and maintained by MieuxVoter.fr. You're browsing the API documentation and sandbox.
You will need a user account to interact with polls.
Head to Registration → POST /users
below.
Click Try it out, set your desired credentials, and execute the query.
Scroll down to see the response.
Use your credentials in the Login → POST /_jwt
, and the API will return a Json Web Token valid for one hour.
Copy the token (not the whole response, and without quotes) in the field behind the Authorize 🔒
button,
prefixed by the word Bearer
.
It should look like: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ…
Poll → POST /polls
Here is an example of what you could send:
{
\"slug\": \"france-presidence-2027\",
\"scope\": \"public\",
\"subject\": \"Présidentielle Française 2027\",
\"proposals\": [
{
\"title\": \"Continuer le néolibéralisme\"
},
{
\"title\": \"Ne pas prendre plus à la nature que ce qu'elle est capable de renouveler\"
},
{
\"title\": \"Former une Assemblée Constituante (Liquide)\"
}
],
\"grades\": [
{ \"name\": \"À Rejeter\", \"level\": 0 },
{ \"name\": \"Insuffisant\", \"level\": 1 },
{ \"name\": \"Passable\", \"level\": 2 },
{ \"name\": \"Assez Bien\", \"level\": 3 },
{ \"name\": \"Bien\", \"level\": 4 },
{ \"name\": \"Très Bien\", \"level\": 5 },
{ \"name\": \"Excellent\", \"level\": 6 }
]
}
Keep the response, you'll need the uuids.
TODO: document invitation generation
Ballot → POST /polls/{pollId}/proposals/{proposalId}/ballots
One request per proposal, for now. We plan on making an endpoint to submit them all at once.
Result → GET /polls/{id}/result
- for php
- for typescript
- …
There are clients we can generate for most languages.
Get in touch if you'd like one in particular!
Or clone this project and use bin/generate-client.bash -t whatever
.
PHP 7.3 and later. Should also work with PHP 8.0 but has not been tested.
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/mieuxvoter/mv-api-client-lib-php.git"
}
],
"require": {
"mieuxvoter/mv-api-client-lib-php": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php
:
<?php
require_once('/path/to/MvApi/vendor/autoload.php');
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: apiKey
$config = MvApi\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = MvApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$apiInstance = new MvApi\Api\AdministrationApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$page = 1; // int | The collection page number
try {
$result = $apiInstance->getUserCollection($page);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AdministrationApi->getUserCollection: ', $e->getMessage(), PHP_EOL;
}
All URIs are relative to https://oas.mieuxvoter.fr
Class | Method | HTTP request | Description |
---|---|---|---|
AdministrationApi | getUserCollection | GET /users | Retrieves the collection of Users. |
BallotApi | apiPollsProposalsBallotsGetSubresource | GET /polls/{pollId}/proposals/{proposalId}/ballots | Retrieves the collection of Ballot resources. |
BallotApi | apiProposalsBallotsGetSubresource | GET /proposals/{id}/ballots | Retrieves the collection of Ballot resources. |
BallotApi | deleteBallotItem | DELETE /ballots/{id} | Removes the Ballot resource. |
BallotApi | getBallotItem | GET /ballots/{id} | Retrieves a Ballot resource. |
BallotApi | postBallotCollection | POST /polls/{pollId}/proposals/{proposalId}/ballots | Creates a Ballot resource. |
GradeApi | apiPollsGradesGetSubresource | GET /polls/{id}/grades | Retrieves the collection of Grade resources. |
GradeApi | getGradeItem | GET /grades/{id} | Retrieves a Grade resource. |
InvitationApi | getForPollInvitationCollection | GET /polls/{id}/invitations | Retrieves the collection of Invitation resources. |
InvitationApi | getInvitationCollection | GET /invitations | Retrieves the collection of Invitation resources. |
InvitationApi | getInvitationItem | GET /invitations/{id} | Retrieves a Invitation resource. |
LoginApi | getMyself | GET /me | Gets information about the authenticating user. |
LoginApi | postCredentialsItem | POST /_jwt | Returns an authentication Token from login Credentials. |
PollApi | apiPollsGradesGetSubresource | GET /polls/{id}/grades | Retrieves the collection of Grade resources. |
PollApi | apiPollsProposalsGetSubresource | GET /polls/{id}/proposals | Retrieves the collection of Proposal resources. |
PollApi | deletePollItem | DELETE /polls/{id} | Removes the Poll resource. |
PollApi | getForPollResultItem | GET /polls/{id}/result | Gets the result of a poll |
PollApi | getPollCollection | GET /polls | Retrieves the collection of Poll resources. |
PollApi | getPollItem | GET /polls/{id} | Retrieves a Poll resource. |
PollApi | postPollCollection | POST /polls | Creates a Poll resource. |
ProposalApi | apiPollsProposalsBallotsGetSubresource | GET /polls/{pollId}/proposals/{proposalId}/ballots | Retrieves the collection of Ballot resources. |
ProposalApi | apiPollsProposalsGetSubresource | GET /polls/{id}/proposals | Retrieves the collection of Proposal resources. |
ProposalApi | apiProposalsBallotsGetSubresource | GET /proposals/{id}/ballots | Retrieves the collection of Ballot resources. |
ProposalApi | getProposalItem | GET /proposals/{id} | Retrieves a Proposal resource. |
ProposalApi | postProposalCollection | POST /polls/{id}/proposals | Creates a Proposal resource. |
RegistrationApi | postUserCollection | POST /users | Registers a new User. |
ResultApi | getForPollResultItem | GET /polls/{id}/result | Gets the result of a poll |
ToolsApi | getJsonResultFromTally | GET /{tally}.json | Resolves the provided tally. |
ToolsApi | getSvgMeritProfileFromTally | GET /render/merit-profile.svg | Generates a merit profile as SVG of the provided tally. |
UserApi | deleteUserItem | DELETE /users/{id} | Removes the User resource. |
UserApi | getMyself | GET /me | Gets information about the authenticating user. |
UserApi | getUserCollection | GET /users | Retrieves the collection of Users. |
UserApi | getUserItem | GET /users/{id} | Gets information about a User. |
UserApi | postCredentialsItem | POST /_jwt | Returns an authentication Token from login Credentials. |
UserApi | postUserCollection | POST /users | Registers a new User. |
UserApi | putUserItem | PUT /users/{id} | Updates information about a User. |
- Ballot
- BallotCreate
- BallotCreated
- BallotJsonld
- BallotJsonldCreate
- BallotJsonldCreated
- BallotJsonldRead
- BallotRead
- Credentials
- GradeCreate
- GradeJsonldCreate
- GradeJsonldRead
- GradeRead
- InvitationJsonldRead
- InvitationRead
- PollCreate
- PollJsonldCreate
- PollJsonldRead
- PollRead
- ProposalCreate
- ProposalGradeResultJsonldRead
- ProposalGradeResultRead
- ProposalJsonldCreate
- ProposalJsonldRead
- ProposalRead
- ProposalResultJsonldRead
- ProposalResultRead
- ResultJsonldRead
- ResultRead
- Token
- UserCreate
- UserEdit
- UserJsonldCreate
- UserJsonldEdit
- UserJsonldRead
- UserRead
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header
To run the tests, use:
composer install
vendor/bin/phpunit
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
0.0.0-dev
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen