1
0
-1

I want to find pets that have a specific word in their breed.  How can I perform that search?

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hello all,

      There are few different filters you could use to perform a search that would find pets with a specific word in any of their breeds.

      All of these options use the search endpoint for animals.

      POST /public/animals/search

      If you know the specific breeds you could search by the breed names or IDs, which is the fastest and most specific/exact way to accomplish the search.  For these two options you would need to know the exact values and IDs in the RescueGroups.org system.

      NOTE: Although we're using the equals operation, we can provide an array of values to match.

      {
          "data": {
              "filters": [
                  {
                      "fieldName": "breeds.name",
                      "operation": "equals",
                      "criteria": ["American Staffordshire Terrier","Staffordshire Bull Terrier"]
                  }            
              ]
          }
      }
      {
          "data": {
              "filters": [
                  {
                      "fieldName": "breeds.id",
                      "operation": "equals",
                      "criteria": ["82","207"]
                  }            
              ]
          }
      }

      You could find pets that have a word in any of their breed names:

      {
          "data": {
              "filters": [
                  {
                      "fieldName": "breeds.name",
                      "operation": "contains",
                      "criteria": "Staffordshire"
                  }            
              ]
          }
      }

      Using the meta data available for the animals you could perform these searches:

      You could find pets that only have the word in their Primary breed:

      {
          "data": {
              "filters": [
                  {
                      "fieldName": "animals.breedPrimary",
                      "operation": "contains",
                      "criteria": "Staffordshire"
                  }            
              ]
          }
      }

      Or search for a word anywhere in their breedString (which is a meta value that contains all breeds, coat length, and mixed together in one string:

      {
          "data": {
              "filters": [
                  {
                      "fieldName": "animals.breedString",
                      "operation": "contains",
                      "criteria": "Staffordshire"
                  }            
              ]
          }
      }

      These are a few different ways to perform similar searches.  There's no right or wrong way to search - it will depend on your application.

      Hope this helps!

      Richard

        CommentAdd your comment...