Answers.Body: <p>The URL was wrong like, @user4278 suggested. It should have been:
  <strong>sitename.org/sites/all/modules/civicrm/extern/rest.php</strong></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-14T20:10:33.110Z
Answers.LastActivityDate: 2018-07-14T20:10:33.110Z
Answers.UserDisplayName: Programming_Noob
Answers.Body: <p>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 <a href="http://domain.tld/civicrm/api#explorer" rel="nofollow noreferrer">http://domain.tld/civicrm/api#explorer</a> 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. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-14T17:49:33.830Z
Answers.LastActivityDate: 2018-07-14T17:49:33.830Z
Answers.UserDisplayName: Dieter Martens
Body: <p>I'm trying to use the Python Civicrm API located here: <a href="https://github.com/tallus/python-civicrm" rel="nofollow noreferrer">https://github.com/tallus/python-civicrm</a> . 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. </p>
  
  <p>I am using an Admin account that has an API key. </p>
  
  <pre><code>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
  </code></pre>
  
  <blockquote>
    <p>pythoncivicrm.pythoncivicrm.CivicrmError: request to
    <a href="https://sitename.org/extern/rest.php" rel="nofollow noreferrer">https://sitename.org/extern/rest.php</a> failed with status code 404</p>
  </blockquote>
  
  <p>If I'm already admin, what other possible reason could it be that I'm still getting blocked?</p>
  
  <p>Thank you!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-13T02:08:33.390Z
Comments.Text: That url looks wrong - for a drupal site it would normally be 
  https://sitename.org/sites/all/modules/civicrm/extern/rest.php
  (ie a full path to the file not one mediated via the CMS)
Comments.UserDisplayName: user4278
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-14T20:09:31.757Z
Comments.Text: Ah! You were right! The second I replaced the URL with that you suggested I was able to return the data. Thanks so much!
Comments.UserDisplayName: Programming_Noob
Tags: <api><admin><rest>
Title: Python Civicrm API Keeps Giving 404 Error
ThreadText: # Python Civicrm API Keeps Giving 404 Error
  
  (Asked by: username_0 on 2018-07-12)
  
  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!
  
  **Tags:** api, admin, rest
  
  > **Comments:**
  > **username_1**: That url looks wrong - for a drupal site it would normally be  https://sitename.org/sites/all/modules/civicrm/extern/rest.php (ie a full path to the file not one mediated via the CMS)  
  > **username_0**: Ah! You were right! The second I replaced the URL with that you suggested I was able to return the data. Thanks so much!  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2018-07-14. Score: 1
  
  The URL was wrong like, @username_1 suggested. It should have been:
  **sitename.org/sites/all/modules/civicrm/extern/rest.php**
  
  
  ---
  
  ### Answer by username_2 on 2018-07-14. Score: 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.
  
  
  ---
  
  