Answers.Body: <p>This URL lets me get contacts from my site externally (without logging in) and without creating a JavaScript client:
  <a href="https://agloa.org/wp-json/civicrm/v3/rest?entity=Contact&amp;action=get&amp;json=1&amp;key=" rel="nofollow noreferrer">https://agloa.org/wp-json/civicrm/v3/rest?entity=Contact&amp;action=get&amp;json=1&amp;key=</a>&lt;site_key&gt;&amp;apiKey=&lt;my_key&gt;</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-30T13:51:59.173Z
Answers.Text: Thanks - searching for how to use the API and this definitely did the trick for me.
Answers.UserDisplayName: Norm Dressler
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-05-25T20:37:35.930Z
Answers.LastActivityDate: 2022-05-25T20:37:35.930Z
Answers.UserDisplayName: MikeSteigerwald
Body: <p>According to <a href="https://docs.civicrm.org/dev/en/latest/api/v3/rest" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/api/v3/rest</a> :</p>
  <blockquote>
  <p>&quot;As of v5.47+, there should be no reason to use extern/rest.php -
  other end-points should be more compatible and more featureful. See
  APIv3 Changelog for migration notes.&quot;</p>
  </blockquote>
  <p>but a simple http request like:</p>
  <blockquote>
  <p><a href="https://agloa.org/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm/ajax/rest&amp;entity=Contact&amp;action=get&amp;json=1&amp;key=site_key&amp;api_key=my_key" rel="nofollow noreferrer">https://agloa.org/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm/ajax/rest&amp;entity=Contact&amp;action=get&amp;json=1&amp;key=site_key&amp;api_key=my_key</a></p>
  </blockquote>
  <p>results in</p>
  <blockquote>
  <p>Ajax requests can only be issued by JavaScript clients, eg. CRM.api3</p>
  </blockquote>
  <p>Does this mean I need to create a JavaScript client as a front-end to my http call?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-20T15:32:26.263Z
Comments.Text: Does the user with that api key have permission Use Ajax Api?
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-20T21:57:45.373Z
Comments.Text: Yes, the user with that api key does have permission Use Ajax Api.
Comments.UserDisplayName: MikeSteigerwald
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-20T22:43:06.137Z
Comments.Text: Do you have the authx extension installed? It changes things a bit - see https://docs.civicrm.org/dev/en/latest/framework/authx/#flows, especially at the bottom where you can relax the settings to see if that's the problem.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-21T14:53:23.260Z
Comments.Text: I do have  the authx extension installed.  Relax the settings does not seem to resolve the problem.
Comments.UserDisplayName: MikeSteigerwald
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-24T15:07:52.997Z
Comments.Text: I just realized the url I'm using forces me to log into my WordPress site before continuing. (As a result, the authx flow is 'already logged in.' That's why it decides my request is not a web service request.)
  
  This is actually a bigger problem for me. Being forced to log in defeats the purpose.
Comments.UserDisplayName: MikeSteigerwald
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-24T15:19:10.573Z
Comments.Text: Oh right wordpress - see if this helps: https://docs.civicrm.org/dev/en/latest/api/v3/wp-rest/
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-24T16:08:29.540Z
Comments.Text: This GET request is working for now, but I'll probably have to change it to a POST in order to use parameters.
  
  https://agloa.org/wp-json/civicrm/v3/rest?entity=Contact&action=get&json=1&key=
Comments.UserDisplayName: MikeSteigerwald
Tags: <api><ajax>
Title: How can I call api directly from external http?
ThreadText: # How can I call api directly from external http?
  
  (Asked by: username_0 on 2022-05-20)
  
  According to <https://docs.civicrm.org/dev/en/latest/api/v3/rest> :
  
  > "As of v5.47+, there should be no reason to use extern/rest.php -
  > other end-points should be more compatible and more featureful. See
  > APIv3 Changelog for migration notes."
  
  but a simple http request like:
  
  > <https://agloa.org/wp-admin/admin.php?page=CiviCRM&q=civicrm/ajax/rest&entity=Contact&action=get&json=1&key=site_key&api_key=my_key>
  
  results in
  
  > Ajax requests can only be issued by JavaScript clients, eg. CRM.api3
  
  Does this mean I need to create a JavaScript client as a front-end to my http call?
  
  **Tags:** api, ajax
  
  > **Comments:**
  > **username_1**: Does the user with that api key have permission Use Ajax Api?  
  > **username_0**: Yes, the user with that api key does have permission Use Ajax Api.  
  > **username_1**: Do you have the authx extension installed? It changes things a bit - see https://docs.civicrm.org/dev/en/latest/framework/authx/#flows, especially at the bottom where you can relax the settings to see if that's the problem.  
  > **username_0**: I do have  the authx extension installed.  Relax the settings does not seem to resolve the problem.  
  > **username_0**: I just realized the url I'm using forces me to log into my WordPress site before continuing. (As a result, the authx flow is 'already logged in.' That's why it decides my request is not a web service request.)  This is actually a bigger problem for me. Being forced to log in defeats the purpose.  
  > **username_1**: Oh right wordpress - see if this helps: https://docs.civicrm.org/dev/en/latest/api/v3/wp-rest/  
  > **username_0**: This GET request is working for now, but I'll probably have to change it to a POST in order to use parameters.  https://agloa.org/wp-json/civicrm/v3/rest?entity=Contact&action=get&json=1&key=  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2022-05-25. Score: 2
  
  This URL lets me get contacts from my site externally (without logging in) and without creating a JavaScript client:
  <https://agloa.org/wp-json/civicrm/v3/rest?entity=Contact&action=get&json=1&key=><site\_key>&apiKey=<my\_key>
  
  > **Comments:**
  > **username_2**: Thanks - searching for how to use the API and this definitely did the trick for me.  
  
  ---
  
  