JQuery Batchbook Rest API Consumption
Given t开发者_Python百科he following API call in Curl, how would I do this in JQuery?
curl -u #{api_key}:x -X GET https://#{your_account}.batchbook.com/service/people.xml
You don't want to do that with jQuery, because it'll expose your API key to your users.
If you really really really decided to use a jQuery AJAX call, though (maybe some sort of internal system where everyone with access would have access to the key), here's the code:
$.ajax({
url: 'https://your-account.batchbook.com/service/people.xml',
username: 'your api key',
password: 'your password'
});
精彩评论