1

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?

7
  • Does the user with that api key have permission Use Ajax Api?
    – Demerit
    May 20 at 15:32
  • Yes, the user with that api key does have permission Use Ajax Api. May 20 at 21:57
  • Do you have the authx extension installed? It changes things a bit - see 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.
    – Demerit
    May 20 at 22:43
  • I do have the authx extension installed. Relax the settings does not seem to resolve the problem. May 21 at 14:53
  • 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. May 24 at 15:07

1 Answer 1

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>

1
  • Thanks - searching for how to use the API and this definitely did the trick for me. Jul 30 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.