- cURL: In this post there is an explanation of what cURL is and how to get it.
- API Key: In this post are directions for getting an API user key.
Lets start by connecting to the API and finding out how many API calls we have available and how many we have used for today.
- Open a command prompt.
- Type: curl -u api_user:api_password "https://yourchurch.ccbchurch.com/api.php?srv=api_status"
- Press enter.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?> <ccb_api> <request> <parameters> <argument value="api_status" name="srv"/> </parameters> </request> <response> <last_run_date>2015-11-02</last_run_date> <daily_limit>10000</daily_limit> <counter>3</counter> </response> </ccb_api>
Note in the above you have to replace api_user with the username you created in the API Key article above and the password with the password created at the same time. Your CCB username and password are not the same as your API Key username and password.
- cURL is the program we are using to make the request.
- -u tells cURL to expect a username (api_user) and a password, separated by a colon (if there wasn't a colon cURL wouldn't know where the username ended and the password began).
- Lastly we have the URL that tells CCB exactly what we are asking for - in this case the api_status.
The CCB API replies with XML. You can learn about XML here.
The meat of things is found within the <response></response> element.
- last_run_date shows us the last day we made a call to the API.
- daily_limit shows the maximum number of calls you can make to the API on a daily basis.
- counter shows how many API calls you have made today.