2

I'm trying to use the Python Civicrm API located here: https://github.com/tallus/python-civicrm . I can connect to the site just fine, but anytime I try to query any of the content I get a 404 Error from the /extern/rest.php.

I am using an Admin account that has an API key.

from pythoncivicrm.pythoncivicrm import CiviCRM

url = 'http://sitename.org'  # works
site_key ='642346924242934720'  # works
api_key ='dbJKbjkse903332'  # works
civicrm = CiviCRM(url, site_key, api_key) # works

search_results = civicrm.get('Contacts') # ERROR

pythoncivicrm.pythoncivicrm.CivicrmError: request to https://sitename.org/extern/rest.php failed with status code 404

If I'm already admin, what other possible reason could it be that I'm still getting blocked?

Thank you!

1

The URL was wrong like, @user4278 suggested. It should have been: sitename.org/sites/all/modules/civicrm/extern/rest.php

0

Why do you use the Python library? You can just call the URL directly with the library request. If you want to get the correct URL you can fo to the page http://domain.tld/civicrm/api#explorer and chose an action, once you chose one, you get the full URL of the request. You'll have to make some changes to the URL tho, you have to replace the site_key and the api_key.

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.