Answers.Body: <p>Yes, all strings will be escaped automatically by the CiviCRM code.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-08T13:40:52.483Z
Answers.LastActivityDate: 2024-01-08T13:40:52.483Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>When running something like this:</p>
  <pre><code>$result = civicrm_api4('Event', 'get', [
      'select' =&gt; ['id'],
      'where' =&gt; [
          ['OR', [
                  ['title', 'LIKE', $keyword],
                  ['summary', 'LIKE', $keyword],
              ]
          ],
      ],
      'checkPermissions' =&gt; false,
  ]);
  </code></pre>
  <p>Should the <code>$keyword</code> variable be escaped or is it something done internally by the API?</p>
  
Tags: <wordpress><api><apiv4>
Title: Do strings used in API version 4 need to be escaped?
ThreadText: # Do strings used in API version 4 need to be escaped?
  
  (Asked by: username_0 on 2024-01-08)
  
  When running something like this:
  
  ```
  $result = civicrm_api4('Event', 'get', [
      'select' => ['id'],
      'where' => [
          ['OR', [
                  ['title', 'LIKE', $keyword],
                  ['summary', 'LIKE', $keyword],
              ]
          ],
      ],
      'checkPermissions' => false,
  ]);
  
  ```
  
  Should the `$keyword` variable be escaped or is it something done internally by the API?
  
  **Tags:** wordpress, api, apiv4
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-01-08. Score: 3 | Accepted answer
  
  Yes, all strings will be escaped automatically by the CiviCRM code.
  
  
  ---
  
  