1
0
-1

Please can you tell me why the following query no longer works? When I last checked, it worked fine. Any help is much appreciated.

The error I get is "1021: You provided an invalid filter field name.":

{
"objectType": "animals",
"search": {
"calcFoundRows": "Yes",
"resultStart": 0,
"resultLimit": 100,
"resultSort": "animalName",
"resultOrder": "asc",
"fields": [
"animalBreed",
"animalColor",
"animalID",
"animalName",
"animalPictures",
"animalSex",
"animalStatus",
"locationName",
"animalLocationID",
"animalMicrochipNumber",
"animalOrigin"
],
"filters": [
{
"fieldName": "animalOrgID",
"operation": "equals",
"criteria": "***"
},
{
"fieldName": "animalStatus",
"operation": "equals",
"criteria": "Available"
}
],
"filterProcessing": "1 and (2)"
},
"token": "***",
"tokenHash": "***",
"objectAction": "search"
}

 

Please note that the following query (that uses publicSearch) still works fine:

{
"objectType": "animals",
"search": {
"calcFoundRows": "Yes",
"resultStart": 0,
"resultLimit": 100,
"resultSort": "animalName",
"resultOrder": "asc",
"fields": [
"animalBreed",
"animalColor",
"animalID",
"animalName",
"animalPictures",
"animalSex",
"animalStatus",
"locationName"
],
"filters": [
{
"fieldName": "animalOrgID",
"operation": "equals",
"criteria": "***"
}
]
},
"apikey": "***",
"objectAction": "publicSearch"
}

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Julian,

      The error message You provided an invalid filter field name means one of the filters you provided is not understood.  The field name on the filter is not known or supported, etc.

      In this case the error is from the animalOrgID field in your filters on the search request.  Because you are using an authenticated request (you have already used the login action to get your token and tokenHash), the animalOrgID filter is not necessary.  The animalOrgID is your account number, and with the authenticated request you will only receive your organization's data/animals anyway, so it's not necessary.

      We wanted developers to be able to start programming with the API as easily as possible, and we thought that it would simplify things if the animalOrgID filter was not necessary on any authenticated requests.

      I don't believe the definition for animals search has changed.  I looked back to it's creation and the definition has not changed that I can find.

      Hope that helps,

      Richard

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Thanks for your prompt response. That fixed it!

         

        Julian Sinai

         

          CommentAdd your comment...