Gustavo Guimaraes • about 12 years ago
500 error
Anybody tried to get translate the cashtie curl http post request example into ruby? I attempted using net/http and the gems Typhoeus and HTTParty but I keep getting 500 errors. I am new to this so any examples would be highly appreciated.
curl -X POST https://testapi.cashtie.com/accounts -H 'Authorization: Token token="some_token"' -H 'Accept: application/vnd.cashtie.com+json; version=1' -H 'Content-Type: application/json' -d '{ "account": { "settings": { "payments": { "amount": { "fixed": 10.99 } }, "upc": "TEST00000000" } } }'
Comments are closed.

3 comments
Thomas Cornelius • about 12 years ago
Gustavo - just saw this. Team will answer for you. For future support requests always use support@cashtie.com
Andrii • about 12 years ago
Gustavo, please try the snippet below:
require 'net/https'
url = URI.parse('https://testapi.cashtie.com/accounts')
req = Net::HTTP::Post.new(url.path)
req.body ='{ "account": { "settings": { "payments": { "amount": { "fixed": 10.99 } }, "upc": "TEST00000000" } } }'
req['Authorization'] = 'Token token="some_token"'
req['Accept'] = 'application/vnd.cashtie.com+json; version=1'
req['Content-Type'] = 'application/json'
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start { |http| http.request(req) }
Gustavo Guimaraes • about 12 years ago
Thank you Thomas and Andrii! The example above will serve as a great piece of reference for when I update the CrowdFundedRecommender application.