Forum Discussion

Pradnya's avatar
Pradnya
Guide
7 years ago

Issue due to apostrophe in V2  API

Hi,
V2 API giving an error for following API call:

V2 call:

SELECT * FROM messages WHERE board.id IN('boardIds') AND depth = 0 AND subject MATCHES  'Test For Latest Idea  Somebody's Test' limit 100

 

I tried in code replacing single quotes with double quotes but doesn't get success

  • Pradnya

    I would suggest you hit the query with single board id and hard code value. Like below so it can be confirmed either there is the API issue or syntax issue. 

    Also, use the encoded match term "Test%20For%20Latest%20Idea%20%20Somebody%27s%20Test". 

    <#assign messages= rest("2.0","/search?q=" + "SELECT * FROM messages WHERE board.id IN('ids') AND depth = 0 AND subject MATCHES 'Test%20For%20Latest%20Idea%20%20Somebody%27s%20Test' limit 100"?url) />
    ${messages.data.size}

    It works fine.  https://prnt.sc/j9fg4d

  • Pradnya - Please try below call

    SELECT * FROM messages WHERE board.id IN('ids') AND depth = 0 AND subject MATCHES  "Test For Latest Idea  Somebody's Test" limit 100
    • Pradnya's avatar
      Pradnya
      Guide
      <#assign queryString = 'SELECT * FROM messages WHERE board.id IN('ids') AND depth = 0 AND subject MATCHES "Test For Latest Idea  Somebody's Test" limit ${liql_limit}' />
      I also tried replacing single quotes by double quotes.