We have updated our API Terms of Service. Please review the entire terms before continuing to use the API. Your use of the API means you accept and agree to the updated API Terms of Service found here: https://rescuegroups.org/api-terms-of-service/
Any field in the object's search definition can be used in a filter.
- equal or equals - the value is the same as the criteria (also used as an "in" operation when the criteria is an array)
- notequal or notequals - the value is different than the criteria
- lessthan - the value is less than (numerically or alphabetically)
- lessthanorequal/lessthanorequals - the value is less or equal to the criteria
- greaterthan - the value is more than (numerically or alphabetically)
- greaterthanorequal or greaterthanorequals - the value is more than or equal to the criteria
- contains/notcontain (string) - the value includes the provided string (e.g., smithe contains smith)
- blank/notblank - does not have a value
- radius - this is a special case for use with location/radius searches including animals, organizations and events. See Radius searches below.
If you want to filter by multiple values (for example, you want to retrieve all pets that are either Baby or Young), you can use the equals operation, and provide an array for the criteria. So, animalGeneralAge equals array("Baby","Young"). An array in the criteria is handled similar to an "in" clause.
The criteria for a filter should match the data/field type (see data types on the HTTP API field properties and data types page).
Leading and trailing spaces are trimmed from the criteria.
There are some special cases:
- rg:contactID - the user's current contactID is used
- rg:today - today's date is used (eastern time)
Filter processing is an advanced feature, and is not required. If you do not include the filterProcessing property to your searches, the filters will be evaluated with "and" (i.e, 1 and 2 and 3, etc.).
The RescueGroups.org HTTP API provides a very powerful way to perform advanced searches.
The method involves sending a string representation of how the filters you provided should be evaluated.
In the following example, we want to search for either small dogs or cats. The filters below specify all of the criteria:
In order to tell the API to process the filters so that we get small dogs and cats, we would include the filterProcessing value:
Some objects, including animals, organization and events, allow for a radius search. For example, a radius search for animals could find adoptable animals that are within a certain number of miles of a specific zip/postal code.
If you notice odd sorting issues (like the results don't seem to be sorting the way you requested), check the tool that you are using. Some tools, like Postman, seem to re-sort results for some reason. If you experience this issue be sure to check the raw results to see if they are sorting correctly.
The following is an example of filters that would search for organizations within 90 miles of the 90210 zip code:
- animals: animalLocation for the zip/postal code and animalLocationDistance for the distance in miles
- orgs: orgLocation for the zip/postal code and orgLocationDistance for the distance in miles
- events: ** COMING SOON
You can sort the results by the distance field so that you can show the closest results at the top of the list.