This is a creation in Article, where the information may have evolved or changed. (i), custom menu--delete
Import ("bytes" "Encoding/json" "FMT" "Github.com/astaxie/beego" "Io/ioutil" "Net/http")
var Url_del = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=" + Acces S_tokenclient: = new (http. Client) Reg, _: = http. Newrequest ("GET", Url_delmenu, nil) resp, _: = client. Do (reg) Defer resp. Body.close () body, _: = Ioutil. ReadAll (resp. Body) var tresp Response//return value struct-body json. Unmarshal (body, &TRESP) if Tresp. Errcode = = 0 {//The menu has been deleted successfully//http:post<pre style= "margin-top:0px; margin-bottom:0px;" ><span style= "color: #c0c0c0;" > </span><span style= "color: #008000;" >//https://api.weixin.qq.com/cgi-bin/menu/create?access_token=access_token</span><span style= "Color : RGB (192, 192, 192); Font-family:arial, Helvetica, Sans-serif; > </span>
var str_menu//Menu JSON string var url_post = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + Access_token var bodytype = "Application/json;charset=utf-8" var bytes_post = bytes. Newbuffer ([]byte (Str_menu)) Res_post, err: = http. Post (Url_post, Bodytype, bytes_post) If Err = = Nil {body_post, _:= ioutil. ReadAll (Res_post. Body) defer res_post. Body.close () var tresp_post responsejson.unmarshal (Body_post, &tresp_post) if Tresp_post. Errcode = = 0 {//Create menu Success} else {this. data["Tdata"] = "Create Menu Failed"}} else {//Create menu failed}} else {//delete menu failed}