We are tying to make a connection to the MYEMMA API which must include an HTTP Basic authentication header containing the public & private API keys for our account.
How do we include this information in our JQuery API call? Here is what we have so far:
<script type="text/javascript">
$(document).ready(function() {
url: "https://api.e2ma.net/123/members/add",
dataType: 'json',
type: "POST"
{
"fields": {
"first_name": "Benjamin"
},
"email": "benjamin@myemma.com"
}
});
</script>
We just need to know how to create the authentication header, including our keys, to include in the call.
For reference: http://myemma.com/api-docs/
What you are currently doing is very far from what you should be doing (it looks like you are giving labels to lots of strings, etc, which cannot be comma separated, which will be an invalid label error).
As per the docs, add
usernameandpasswordkeys to your$.ajax().You don’t need to wait for the DOM to be ready to fire a XHR.