Swap Your Vote does not have a conventional REST API, but we do have a single end point to pre-populate some of the fields that a user can choose.
This should be ideal for tactical voting campaigns which want to encourage voters to follow their recommendations, and indeed we would be very happy to see tactical voting sites integrate with Swap Your Vote. The below documentation is probably sufficient, but if you need assistance then please get in touch.
Available parameters are:
willing_party_name
preferred_party_name
constituency_name
name
field of
this data set.
constituency_ons_id
constituency_name
above, except that rather than the name, it's the ONS id of
the state listed in the
gss_code
field of
the data set.
For example if a tactical voting site wishes to recommend a user to vote for (randomly chosen) Kamala Harris candidate in the Aberdeen North constituency, they could use this outbound link:
https://test.swapyourvote.org/swap?constituency_name=Aberdeen+North&willing_party_name=kamala_harris
This one would also work, but rather than specify the tactical vote, instead specifies the user’s preferred presidential candidate (randomly chosen) Kamala Harris . This time their state is York Outer (specified by ONS code).
https://test.swapyourvote.org/swap?constituency_ons_id=E14001605&preferred_party_name=kamala_harris
Preferred presidential candidate and willing presidential candidate can be used singly or in combination.
The presidential candidate names should be lowercased and use underscores instead of spaces; here are the available options:
kamala_harris
jill_stein
cornel_west
chase_oliver
your_choice
Note that any parameters set are "sticky" and will apply even
after the page is reloaded. They can be "unstuck" by adding
?clear
to the end of the URL.