public static string DeleteMenu(string accessToken) { using (var wc = new System.Net.WebClient()) { var url = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=" + accessToken; var res = wc.DownloadData(url); return(Utities.GetStringFromBytes(res)); } }
public static string AddMenu(string accessToken, string menu) { using (var wc = new System.Net.WebClient()) { var data = Utities.GetBytesFromString(menu); var url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + accessToken; var res = wc.UploadData(url, data); return(Utities.GetStringFromBytes(res)); } }
//// Menu ////////// public static string AccessToken(string appid = "wx8980382cb43a6897", string appsecret = "1137740a67c5152a9cd7af37abb4cd28") { string url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + appsecret; using (var wc = new System.Net.WebClient()) { var data = wc.DownloadData(url); string accessToken = Utities.GetStringFromBytes(data); return(accessToken); } }