developer-documentation icon indicating copy to clipboard operation
developer-documentation copied to clipboard

[REST-API] Example incorrect

Open TheDevMinerTV opened this issue 3 years ago • 0 comments

Hey there 👋

It seems like the example URL given for advanced filtering on the /api/contacts endpoint is invalid. When I try to cURL it to my Mautic 3.3.2 instance, it just throws a 500 error.

The URL in the documentation is: https://[your_mauitc_domain]/api/contacts?where%5B0%5D%5Bcol%5D=phone&where%5B0%5D%5Bexpr%5D=in&where%5B0%5D%5Bval%5D=444444444,888888888 (yes, that typo is in there too) URL-Decoding the query string results in this: where[0][col]=phone&where[0][expr]=in&where[0][val]=444444444,888888888

This should evaluate to this JSON

{
  "where": [
    {
      "col": "phone",
      "expr": "in",
      "val": "444444444,888888888"
    }
  ]
}

This is the error logged to my log files:

[2021-06-10 09:31:50] mautic.CRITICAL: Uncaught PHP Exception InvalidArgumentException: ""expr" is missing in the where clause array." at /var/www/html/app/bundles/CoreBundle/Entity/CommonRepository.php line 852 {"exception":"[object] (InvalidArgumentException(code: 0): \"expr\" is missing in the where clause array. at /var/www/html/app/bundles/CoreBundle/Entity/CommonRepository.php:852)"} []

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

TheDevMinerTV avatar Jun 10 '21 12:06 TheDevMinerTV