如何使用 POST 参数到外部 URL 来调用 Rails 3 中的某些 Web 服务?我通常使用这样的东西从命令行发布
curl -X POST -u "v10REVkw:XuCqIhyCw" \
-H "Content-Type: application/json" \
--data '{"apids": ["c80-d363237c-e513b"], "android": {"alert": "Android Test!"}}' \
https://url/to/push
最佳答案
我想我会使用Rest client 。这是直接来自他们文档的示例:
RestClient.post "http://example.com/resource", { 'x' => 1 }.to_json, :content_type => :json, :accept => :json
关于javascript - 在 Rails 3 中发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5771419/