Open Elect's API is organized around REST.
GET https://openelect.org/api/v1/admin
POST https://openelect.org/api/v1/elections/create
curl https://openelect.org/api/v1/elections/create \
-u { USER_TOKEN }: \
-d owner_id="" \
-d name="" \
-d description=""
{
election: {
name: 'Election Name',
description: 'Federal elections for United States Presidency and Congress',
start_date: 1446976800,
end_date: 1447052399,
is_timed: true,
privacy_strategy: 'secret',
randomize_questions: true,
allow_2_auth: true,
force_2_auth: false,
}
}
{
election: {
id: 90152848,
url: '/elections/90152848',
name: 'Election Name',
created_at: 'Date Created'
}
}
GET https://www.skilfullcactus.com/api/v1/elections/{ ELECTION_ID }
curl https://www.skilfullcactus.com/api/v1/elections/{ ELECTION_ID } \
-u { USER_TOKEN }:
[
{
pollName: 'Federal',
questions: [
{
question: 'Who should be the next president?',
instructions: 'Vote for only one.',
options: [
{name: 'Barack Obama', party: 'Democratic', statement:'The change we need.'},
{name: 'John McCain', party: 'Republican', statement: 'I'm a maverick.'}
]
},
{
question: 'Who should represent California's 8th Congressional District?',
instructions: 'Vote for only one.',
options: [
{name: 'Nancy Pelosi', party: 'Democratic', statement: 'I have been doing this forever.'},
{name: 'Cindy Sheehan', party: 'Independent', statement: 'It's worth a shot.'},
{name: 'Dana Walsh', party: 'Republican', statement: 'I don't have a chance.'}
]
}
]
},
{
pollName: 'Municipal',
questions: [
{
question: 'Who should represent the Board of Supervisors for District 11?',
instructions: 'Vote for only one.',
options: [
{name: 'John Avalos', party: 'Democratic', statement: 'I won.'},
{name: 'Asha Safai', party: 'Democratic', statement: 'I came close!'}
]
}
]
}
];
POST https://openelect.org/api/v1/elections/id/{ ELECTION_ID }
curl https://openelect.org/api/v1/elections/id/{ ELECTION_ID } \
-u { USER_TOKEN }: \
-d owner_id="" \
-d name="" \
-d description="" \
-d start="" \
-d end="" \
-d timed="" \
-d accepting_votes="" \
-d locked="" \
-d privacy_strategy="" \
-d url_handle="" \
-d randomize_answer_order="" \
-d two_factor_auth="" \
-d force_two_factor_auth=""
GET https://openelect.org/api/v1/elections/results/{election_id}
{
"results": {
"election_id": 21231,
"questions": [
{
"question": {
"id": 583421,
},
"totals": [
{
"id": 1,
"votes": 100
},
{
"id": 2,
"votes": 100
},
{
"id": 3,
"votes": 200
},
]
}
]
}
}
GET https://www.skilfullcactus.com/api/v1/elections
curl https://www.skilfullcactus.com/api/v1/elections?limit=10 \
-u { USER_TOKEN }:
{
poll: {
name: 'Poll Name',
description: 'Poll Description',
election_id: 1
},
questions: [
{
name: 'Poll Question Name',
description: 'Poll Question Description',
options: [
{
name: 'Option Name',
description: 'Option Description'
}
]
}
]
}
POST https://openelect.org/api/v1/polls/create
curl https://openelect.org/api/v1/polls/create \
-u { USER_TOKEN }: \
-d name="" \
-d description="" \
-d election_id=""\
{
poll: {
id: 09341213,
url: '/polls/09341213'
name: 'Poll Name',
created_at: 'Date Created'
}
}
GET https://www.skilfullcactus.com/api/v1/polls/{ POLL_ID }
curl https://www.skilfullcactus.com/api/v1/polls/{ POLL_ID } \
-u { USER_TOKEN }:
{
poll: {
name: 'Poll Name',
description: 'Poll Description'
},
questions: [
{
name: 'Poll Question Name',
description: 'Poll Question Description',
options: [
{
name: 'Option Name',
description: 'Option Description'
}
]
}
]
}
POST https://www.skilfullcactus.com/api/v1/polls/{ POLL_ID }
curl https://www.skilfullcactus.com/api/v1/polls/{ POLL_ID } \
-u { USER_TOKEN }: \
-d name="" \
-d description="" \
{
response: {
items: [
{
selection: 01311
},
{
selection: 01312
}
]
}
}
DELETE https://openelect.org/api/v1/polls/{ POLL_ID }
curl https://www.skilfullcactus.com/api/v1/polls/{ POLL_ID } \
-u { USER_TOKEN }: \
-X DELETE
GET https://openelect.org/api/v1/polls
curl https://www.skilfullcactus.com/api/v1/polls?limit=10 \
-u { USER_TOKEN }:
{
ballot: {
election_id: 3902340,
user_id: 438572936,
}
questions: {
selected: [
{
question_id: 123412
selection: 1
},
{
selection: 2
}
]
}
}
POST https://openelect.org/api/v1/ballots/create
curl https://openelect.org/api/v1/ballots/create \
-u { USER_TOKEN }: \
-d election_id=8952374 \
-d user_id=20394820
{
ballot_id: 98342654,
receipt: '9017c7e20b1a0abc3505ea1a8972c06055168140',
election_id: 28934237,
created_at: 'Date Created'
}
{ question: { id: 1, title: 'Who should be the next representative from the 2nd district' } options: [ { name: 'Wally Herger', description: 'Incumbent', party: ‘Republican', // optional id: 1 }, { name: 'Ryan Carey', description: 'Software Engineer', party: ‘Pirate’, id: 2 } ] }
POST https://openelect.org/api/v1/questions/create
curl https://openelect.org/api/v1/questions/create \
-u { USER_TOKEN }: \
-d KEY1=VAL1 \
-d KEY2=VAL2
{}
GET https://openelect.org/api/v1/questions/{ QUESTION_ID }
curl https://openelect.org/api/v1/questions/{ QUESTION_ID } \
-u { USER_TOKEN }:
{}
POST https://openelect.org/api/v1/questions/{ QUESTION_ID }
curl https://openelect.org/api/v1/questions/{ QUESTION_ID } \
-u { USER_TOKEN }: \
-d KEY1=VAL1 \
-d KEY2=VAL2
{}
DELETE https://openelect.org/api/v1/questions/{ QUESTION_ID }
curl https://openelect.org/api/v1/questions/{ QUESTION_ID } \
-u { USER_TOKEN }: \
-X DELETE
GET https://openelect.org/api/v1/questions
curl https://openelect.org/api/v1/questions?limit=10
-u { USER_TOKEN }: \
POST https://openelect.org/api/vi/groups/create
curl https://openelect.org/api/v1/questions/create \
-u { USER_TOKEN }: \
-d name='CA-11' \
{
name: 'CA-11',
owner_id: 'uuid',
id: 'uuid'
}
GET https://openelect.org/api/vi/groups/create
curl https://openelect.org/api/v1/groups/list?own=true \
-u { USER_TOKEN }: \
[{
name: 'CA-11',
owner_id: 'uuid',
id: 'uuid',
parent: 'uuid',
children: ['uuid']
},
{
name: 'CA-12',
owner_id: 'uuid',
id: 'uuid',
parent: 'uuid',
children: ['uuid']
}]
POST https://openelect.org/api/v1/groups/csv
curl https://openelect.org/api/v1/groups/csv
-u { USER_TOKEN }:
-d voter-roll.csv \
Returns 201 status and JSON object with array of arrays representing first 10 rows of CSV for preview display.