Answers.Body: <p>We tried turning off all plug-ins except for the CiviCRM plug-in.  The rest.php endpoint began working perfectly.  We were able to turn back on all plug-ins except for "Recent Tweets".  I'm surprised something so benign sounding as "Recent Tweets" was the culprit!</p>
  
  <p>(Thanks to Ramesh for helping me look at some things earlier today!)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-21T18:31:00.010Z
Answers.LastActivityDate: 2017-12-21T18:31:00.010Z
Answers.UserDisplayName: Troy
Answers.Body: <p>To get the rest API working, you need to call an url looking like that (this example to create a contact)</p>
  
  <pre><code>http://www.mysite.com/wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=Contact&amp;action=create&amp;api_key=(myAPIkey)&amp;key=(mySiteKey)&amp;json={“contact_type":"Individual","first_name":"Tester","last_name":"Yolanda"}
  </code></pre>
  
  <p>The specific path to rest.php depends on what CMS you use</p>
  
  <p>A few pointers:</p>
  
  <ul>
  <li>you need to set the key with the site key (from civicrm.settings.php) </li>
  <li>you need to create an api key on the contact that peforms the operation, and</li>
  <li>this contact needs to a user that has the appropriate permission (start with an admin account to rule out the permission issue)</li>
  </ul>
  
  <p>This being said, your error message is not normal, you should get a <strong>"Failed to authenticate key"</strong> error message</p>
  
  <pre><code>https://civicrm.org/sites/all/modules/civicrm/extern/rest.php
  </code></pre>
  
  <p>it might be that you don't use the proper url to reach the rest.php file, or that something needs to be configured on your webserver so it's properly processed</p>
  
  <p>What is the url you try? it's a different one from the ajax api used by the api explorer</p>
  
  <p>X+</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-19T15:54:16.357Z
Answers.Text: My url is something like this:
    https://www.example-domain.com/wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=Setting&action=get&api_key=userkey&key=sitekey&json={}
Answers.UserDisplayName: Troy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-19T15:56:28.493Z
Answers.Text: Of course I replace the placeholders in that url with the site key and the api key I created for my user account.  I've done a previous integration and when I provide an incorrect site key or api key I get back a very specific error message.  Until this is all working with my new client, I can't be sure I'm using the correct site key and api key ... but the fact that I'm getting this non-standard error message makes me think there's a bigger configuration issue going on.
Answers.UserDisplayName: Troy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-20T06:15:59.937Z
Answers.Text: agree with your analysis, you get a weird error message, that doesn't seem to come from civi. There is something else going on, either at the apache/nginx level or in wp. start debugging (big die ("I'm here") at the top of your rest.php to at least be sure you're talking to the right file
Answers.UserDisplayName: Xavier
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-20T17:37:54.847Z
Answers.Text: That's an excellent idea, Xavier.  I'll contact the hosting company to see if they can modify rest.php so that it should in theory return some other obvious error message.  I'll keep you all posted.
Answers.UserDisplayName: Troy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-19T10:38:32.877Z
Answers.LastActivityDate: 2017-12-19T10:38:32.877Z
Answers.UserDisplayName: Xavier
Answers.Body: <p>I assume you have set your site key and api key correctly. This is something the REST will need and your API explorer will not. What API are you actually calling so I can do a test locally as well?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-19T16:01:31.647Z
Answers.Text: My url is something like this:
      https://www.example-domain.com/wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=Setting&action=get&api_key=userkey&key=sitekey&json={}
Answers.UserDisplayName: Troy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-19T08:45:18.333Z
Answers.LastActivityDate: 2017-12-19T08:45:18.333Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>I'm trying to connect to the rest api from a remote server, and the only response I ever get back is:</p>
  
  <p><em><code>var jsondata = {"currencySymbol":"$","is_error":true};</code></em></p>
  
  <p>I'm able to make api calls from the site's API Explorer (within the same domain).  But no matter what I do from my remote host, any calls to this site's rest.php always return that same generic response.</p>
  
  <p>Is there something one must to do allow external access to the REST API?  Or does this response hint at some other request filtering taking place?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-19T09:39:07.957Z
Comments.Text: Make sure you have your api_key for the admin user - If you are still getting issue let me know i will help you - thanks
Comments.UserDisplayName: Ramesh - ARTECH Consultancy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-19T15:58:53.577Z
Comments.Text: This site has CiviCRM integrated into WordPress.  How can I make sure that my user account is an administrator?  I do see the "Administer" menu when logged in.  But also, shouldn't I get a more specific error message telling me what the problem is?
Comments.UserDisplayName: Troy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-19T23:22:35.430Z
Comments.Text: Ramesh, I'd love to take you up on your offer to help.  Please reach out when you get a chance.
Comments.UserDisplayName: Troy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-20T09:07:57.420Z
Comments.Text: please try the below link by replacing yoursitename, apikey, sitekey against the browser and let me know what error are you getting -    "http://yoursitename/wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=contact&action=get&api_key=apikey&key=sitekey&json=1"
Comments.UserDisplayName: Ramesh - ARTECH Consultancy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-20T09:16:02.470Z
Comments.Text: ping me in https://chat.civicrm.org/
Comments.UserDisplayName: Ramesh - ARTECH Consultancy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-20T17:37:01.210Z
Comments.Text: Hi Ramesh, I tried that link, replacing my domain, apikey and sitekey, and I received my same response "var jsondata = ...".  I'll try reaching out to you on chat.
Comments.UserDisplayName: Troy
Tags: <api><rest>
Title: How to connect to REST API from remote host?
ThreadText: # How to connect to REST API from remote host?
  
  (Asked by: username_0 on 2017-12-19)
  
  I'm trying to connect to the rest api from a remote server, and the only response I ever get back is:
  
  *`var jsondata = {"currencySymbol":"$","is_error":true};`*
  
  I'm able to make api calls from the site's API Explorer (within the same domain). But no matter what I do from my remote host, any calls to this site's rest.php always return that same generic response.
  
  Is there something one must to do allow external access to the REST API? Or does this response hint at some other request filtering taking place?
  
  **Tags:** api, rest
  
  > **Comments:**
  > **username_1**: Make sure you have your api_key for the admin user - If you are still getting issue let me know i will help you - thanks  
  > **username_0**: This site has CiviCRM integrated into WordPress.  How can I make sure that my user account is an administrator?  I do see the "Administer" menu when logged in.  But also, shouldn't I get a more specific error message telling me what the problem is?  
  > **username_0**: Ramesh, I'd love to take you up on your offer to help.  Please reach out when you get a chance.  
  > **username_1**: please try the below link by replacing yoursitename, apikey, sitekey against the browser and let me know what error are you getting -    "http://yoursitename/wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=contact&action=get&api_key=apikey&key=sitekey&json=1"  
  > **username_1**: ping me in https://chat.civicrm.org/  
  > **username_0**: Hi Ramesh, I tried that link, replacing my domain, apikey and sitekey, and I received my same response "var jsondata = ...".  I'll try reaching out to you on chat.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_0 on 2017-12-21. Score: 1 | Accepted answer
  
  We tried turning off all plug-ins except for the CiviCRM plug-in. The rest.php endpoint began working perfectly. We were able to turn back on all plug-ins except for "Recent Tweets". I'm surprised something so benign sounding as "Recent Tweets" was the culprit!
  
  (Thanks to Ramesh for helping me look at some things earlier today!)
  
  
  ---
  
  ### Answer by username_2 on 2017-12-19. Score: 1
  
  To get the rest API working, you need to call an url looking like that (this example to create a contact)
  http://www.mysite.com/wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=Contact&action=create&api_key=(myAPIkey)&key=(mySiteKey)&json={“contact_type":"Individual","first_name":"Tester","last_name":"Yolanda"}
  
  The specific path to rest.php depends on what CMS you use
  A few pointers:
  
  you need to set the key with the site key (from civicrm.settings.php) 
  you need to create an api key on the contact that peforms the operation, and
  this contact needs to a user that has the appropriate permission (start with an admin account to rule out the permission issue)
  
  This being said, your error message is not normal, you should get a "Failed to authenticate key" error message
  https://civicrm.org/sites/all/modules/civicrm/extern/rest.php
  
  it might be that you don't use the proper url to reach the rest.php file, or that something needs to be configured on your webserver so it's properly processed
  What is the url you try? it's a different one from the ajax api used by the api explorer
  X+
  
  > **Comments:**
  > **username_0**: My url is something like this:   https://www.example-domain.com/wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=Setting&action=get&api_key=userkey&key=sitekey&json={}  
  > **username_0**: Of course I replace the placeholders in that url with the site key and the api key I created for my user account.  I've done a previous integration and when I provide an incorrect site key or api key I get back a very specific error message.  Until this is all working with my new client, I can't be sure I'm using the correct site key and api key ... but the fact that I'm getting this non-standard error message makes me think there's a bigger configuration issue going on.  
  > **username_2**: agree with your analysis, you get a weird error message, that doesn't seem to come from civi. There is something else going on, either at the apache/nginx level or in wp. start debugging (big die ("I'm here") at the top of your rest.php to at least be sure you're talking to the right file  
  > **username_0**: That's an excellent idea, username_2.  I'll contact the hosting company to see if they can modify rest.php so that it should in theory return some other obvious error message.  I'll keep you all posted.  
  
  ---
  
  ### Answer by username_3 on 2017-12-19. Score: 0
  
  I assume you have set your site key and api key correctly. This is something the REST will need and your API explorer will not. What API are you actually calling so I can do a test locally as well?
  
  > **Comments:**
  > **username_0**: My url is something like this:     https://www.example-domain.com/wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=Setting&action=get&api_key=userkey&key=sitekey&json={}  
  
  ---
  
  