Metadata query "Like" syntax?

New post



  • dandennhardt

    I think the problem is not that there is a problem with the ILIKE syntax, but that you aren't paramaterizing arguments where expected. In the first example you use "managers IS NOT NULL" which is fine since NULL is a reserved keyword. However in the seond example, you use "managers ILIKE %flex%" - which is not fine, because `query` expects references to fields, operators, keywords, and arguments, but %flex% is a literal. Instead, you should do something like the following, where you specify the argument in`query_params` ... Sorry if the syntax is not exactly write in this language, but hopefully it illustrates the point. 

    var query = "managers ILIKE :myArg";
    var search = client.MetadataManager.ExecuteMetadataQueryAsync(
        query: query,
    	query_params: "myArg":"%flex%",
        from: $"{enterpriseId}.{templateKey}",
        ancestorFolderId: "0"


    Here's an example of the raw JSON using ILIKE which works just fine - I verified this in Postman.

      "from": "{{scope}}.{{templateKey}}",
      "query": "photographer ILIKE :name",
      "query_params": {"name": "dan"},
      "ancestor_folder_id" : "0",
      "order_by": [
          "field_key": "photographer",
          "direction": "asc"
      "limit": 10


    Comment actions Permalink
  • cbetta

    Thank you for clarifying .


     I've updated the code sample for you on the docs.


    Comment actions Permalink

Please sign in to leave a comment.