Using where/filter in API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mikeg13
    Junior Member
    • Jan 2018
    • 5

    Using where/filter in API



    The documentation is a little light on how to filter using the where operator.

    Could someone share an example of how to filter using multiple fields? For example, I have an entity "Location" and I want to see only the results where the brand is McDonalds. I've tried a variety of ways to pass in what the docs say "where - (array) filters;" with no success:
    https://connectiv.espocloud.com/api/v1/location?where=["brand": "McDonalds"]
    https://connectiv.espocloud.com/api/v1/location?where:["brand": "McDonalds"]
    https://connectiv.espocloud.com/api/v1/location?where=["brand"="McDonalds"]

    Can someone share the syntax here?

    Thanks
    Mike
  • oscarbm92
    Junior Member
    • May 2017
    • 18

    #2
    Same problem here, you did it? can you share?

    EDIT:

    I figured it out....

    The way you can use where in your case is:

    https://connectiv.espocloud.com/api/v1/location?where[0][type]=equals&where[0][field]=brand&where[0][value]=McDonalds

    Hope this help you and others trying to deal with the incomplete documentation.
    Last edited by oscarbm92; 06-17-2018, 04:57 AM. Reason: I figured it out

    Comment


    • telecastg
      telecastg commented
      Editing a comment
      Thank you so much for sharing, I am struggling with the syntax used for "where" filtering when a field if filled by the system and wish there was some documentation about it too.
Working...