0

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?

1
  • When you read the message it would explain why... You should use HTTP Post for the API calls Dec 1 '15 at 15:48
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)

1

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.