Skip to content

API Tokens

David Colangelo edited this page Aug 16, 2018 · 6 revisions

API Frontend Tokens

To use the Jefferson's List API you will need a token. This tracks your usage as well as allows you access to the API. This is a public facing token for deployment with your frontend.

The token must be passed over as a header with the name

JLAuthToken

For example a call to our Voter Registration endpoint might look something like this.

function submitInfo(){
	$.ajax({
        type: "POST",
        url: "https://jeffersonslist.com/api/VoterRegistration/SubmitVoterInfo",
        contentType: "application/json",
        dataType: "json",
        headers: {
        	"JLAuthToken":"XXXXXXX-TOKEN-XXXXXXXX"
        },
        data: JSON.stringify({
          Email : document.getElementById('email').value,
          Address : document.getElementById('address').value,
          City : document.getElementById('city').value,
          StateAbrev : document.getElementById('state').value,
          Zip : document.getElementById('zip').value,
          IsCitizen:true
        }),
        success: function( result ) {
            //Display the result data as needed 
        }
	});
}

An invalid token will return a 403 HTTP status code and should be handled by the user appropriately.

To get an access token contact us directly at info@jeffersonslist.com

Clone this wiki locally