简体   繁体   English

尝试使用ruby HTTParty发送删除

[英]Trying to send a delete using ruby HTTParty

require 'httparty'
require 'json'
response = HTTParty.delete("https://api.cloudflare.com/client/v4/zones/5746746785687568678785/purge_cache",
            :headers => { "X-Auth-Email" => "myemail@company.com" , "X-Auth-Key" => "7456785476856789567965","Content-Type" => "application/json" } ,
            :body => {:"purge_everything" => "true"}.to_json
            )
puts response.body, response.message

I keep receiving purge_everything must be set to true as a response. 我一直收到purge_everything必须设置为true作为响应。 Any ideas? 有任何想法吗?

Your Ruby code looks alright, you've only mistyped true as "true" for the purge_everything parameter. 你的Ruby代码看起来还好,你只输错true"true"purge_everything参数。

According to Cloudflare's API docs , the JSON should look like {"purge_everything": true} . 根据Cloudflare的API文档 ,JSON应该类似于{"purge_everything": true}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM