Answers.Body: <p>Please post the full url you call, but you probably have an error on the url, it should have an action=get (or getcount or get*) param. If it doesn't, it blocks the access, because it doesn't know it's a read only action that can actually be performed over a GET method</p>
  
  <p>However, as Jaap mentioned, I would recommend you to use POST all the time, no matter the action you want to perform, it's easier and cleaner.</p>
  
  <p>FYI, in my client libraries, I tend to have the action+entities as get param and all the rest into post. The main reason is that it's giving cleaner logs to help understand what's going on, without leaking any sensitive information</p>
  
  <p>Please share if you write a gem to wrap up the rest call inside a ruby framework, I'd be interested to use it on one of my project (sinatra, but probably going to work the same)  </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-26T15:04:59.880Z
Answers.Text: do you know why i get same error but i don't have get in full URL, see my URL here http://site.example.com/sitename/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=post&api_key=2bksomeuserkeygOX7O&key=2bksitegOX7&json={"sequential":1,"return":"custom_27"}
Answers.UserDisplayName: Kboy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-01T15:58:33.690Z
Answers.LastActivityDate: 2015-12-01T15:58:33.690Z
Answers.UserDisplayName: Xavier
Body: <p>I'm working on a ruby on rails application and trying to pull data from a civi crm server. I'm sending the get request from Rails but ending up with</p>
  
  <pre><code>{"IP":"some IP","level":"security","referer":"","reason":"Destructive HTTP GET","is_error":1,"error_message":
  "SECURITY: All requests that modify the database must be http POST, not GET."}
  </code></pre>
  
  <p>Can someone tell me why is that and how to get data from civicrm server?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-12-01T15:48:23.753Z
Comments.Text: When you read the message it would explain why... You should use HTTP Post for the API calls
Comments.UserDisplayName: Jaap Jansma - CiviCooP
Tags: <api>
Title: civi crm get request not working
ThreadText: # civi crm get request not working
  
  (Asked by: username_0 on 2015-12-01)
  
  I'm working on a ruby on rails application and trying to pull data from a civi crm server. I'm sending the get request from Rails but ending up with
  {"IP":"some IP","level":"security","referer":"","reason":"Destructive HTTP GET","is_error":1,"error_message":
  "SECURITY: All requests that modify the database must be http POST, not GET."}
  
  Can someone tell me why is that and how to get data from civicrm server?
  
  **Tags:** api
  
  > **Comments:**
  > **username_1**: When you read the message it would explain why... You should use HTTP Post for the API calls  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2015-12-01. Score: 2
  
  Please post the full url you call, but you probably have an error on the url, it should have an action=get (or getcount or get\*) param. If it doesn't, it blocks the access, because it doesn't know it's a read only action that can actually be performed over a GET method
  
  However, as Jaap mentioned, I would recommend you to use POST all the time, no matter the action you want to perform, it's easier and cleaner.
  
  FYI, in my client libraries, I tend to have the action+entities as get param and all the rest into post. The main reason is that it's giving cleaner logs to help understand what's going on, without leaking any sensitive information
  
  Please share if you write a gem to wrap up the rest call inside a ruby framework, I'd be interested to use it on one of my project (sinatra, but probably going to work the same)
  
  > **Comments:**
  > **username_3**: do you know why i get same error but i don't have get in full URL, see my URL here http://site.example.com/sitename/sites/all/modules/civicrm/extern/rest.php?entity=Contact&action=post&api_key=2bksomeuserkeygOX7O&key=2bksitegOX7&json={"sequential":1,"return":"custom_27"}  
  
  ---
  
  