1
0
-1

Hello. I'm trying to get this code to filter species of animals, and it never seems to work. I still get back cats other animals. What am I missing here? 

      "apikey":"****",
      "objectType":"animals",
      "objectAction":"publicSearch",
      "search":
      {
        "resultStart": "0",
        "resultLimit": "10",
        "resultSort": "animalID",
        "resultOrder": "asc",
        "filters":
        [
          {
             "fieldName": "speciesSingular",
             "operation": "equals",
             "criteria": "Dog"
          },
        ],
        "filterProcessing": "1",
        "fields":
        [                                  
            "animalSpecies"
        ]
    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      Natalie,

      You should use the fieldName animalSpecies (not speciesSingular).  Can you tell me where you saw speciesSingular being used in an animal publicSearch?

      {
          "apikey":"*****",
          "objectType":"animals",
          "objectAction":"publicSearch",
          "search":
          {
              "resultStart": "0",
              "resultLimit": "10",
              "resultSort": "animalID",
              "resultOrder": "asc",
              "filters":
              [
                  {
                      "fieldName": "animalSpecies",
                      "operation": "equals",
                      "criteria": "Dog"
                  }
              ],
              "fields": ["animalID","animalSpecies","animalOrgID","animalLocation","animalName"]
          }
      }

       

      Thanks,

      Richard

      1. Richard [RG]

        Just for clarification -- you don't have to specify the filterProcessing value if all of your filters are "and". So in most cases you probably don't have to provide the filterProcessing value.

      2. Natalie

        Hey Richard, that fixed it! Thanks so much for the speedy response! I saw speciesSingular here: https://userguide.rescuegroups.org/display/APIDG/Sample+API+requests#SampleAPIrequests-animalSpecies Also, just so you know, you have a live apikey here: https://userguide.rescuegroups.org/display/APIDG/Sample+API+requests#SampleAPIrequests-publicSearch.3

      CommentAdd your comment...