/
Code Samples
Code Samples
Below are some code examples to help you get started with using our API. All sample code and information are provided "as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
PHP
Authenticating + list of animals with no filters.
<?php $headers = array("content-type:application/json"); $shelterbuddyUrl = "https://mysite.shelterbuddy.com"; $username = urlencode("my@username"); $password = urlencode("myS3ecureP@ssw@rd"); $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $shelterbuddyUrl . sprintf("/api/v2/authenticate?username=%s&password=%s", $username, $password)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); $authToken = json_decode($result); array_push($headers, sprintf("sb-auth-token:%s", $authToken)); $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $shelterbuddyUrl . sprintf("/api/v2/animal/list?PageSize=%s", 1)); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "{ }"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); $result = json_decode($result); var_dump($result); ?>
Open Source Software
The below link is a project that enables developers to cache the ShelterBuddy API on AWS for improved performance, if you use this share some love with alexramos1.
, multiple selections available,
Related content
Animals
Animals
Read with this
Authentication
Authentication
More like this
Pagination
Pagination
Read with this
Animals /api/animals
Animals /api/animals
More like this
Webhooks
Webhooks
Read with this
ShelterBuddy API V2.0.0.0
ShelterBuddy API V2.0.0.0
More like this