I am using ruby and rest-client gem.
I try to communicate with a RESTFUL API.
It's working fine if I use the following:
RestClient.post "http://www.restfulapi.com/students/284433/enroll", {:token => token, :param1 => "56303", :param2 => ""}.to_json, :content_type => :json
but if I decide to use the active resource style:
api = RestClient::Resource.new "http:/www.restfulapi.com"
response = api["/students/284433/enroll"].post :params => {:token => token, :param1 => "56303", :param2 => ""}
I get an error 412 Precondition Failed (RestClient::PreconditionFailed)
I am not sure what exactly is the difference and why one is working and not the other.
Thank you