Swap My 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 My 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
PCON18NM
field of
this data set.
constituency_ons_id
constituency_name
above, except that rather than the name, it's the ONS id of
the constituency listed in the
PCON18CD
field of
the data set.
For example if a tactical voting site wishes to recommend a user to vote for the Liberal Democrat candidate in the Somerton and Frome consitituency, they could use this outbound link:
https://www.swapmyvote.uk/swap?constituency_name=Somerton+and+Frome&willing_party_name=liberal_democrats
This one would also work:
https://www.swapmyvote.uk/swap?constituency_name=E14000932&willing_party_name=liberal_democrats
The party names should be lowercased and use underscores instead of spaces. We support 7 parties at the moment, with the follow canonical names on Swap My Vote:
labour
liberal_democrats
green_party
conservatives
ukip
snp
plaid_cymru