示例#1
0
文件: Tags.cs 项目: songfj/RSSharp
        public static bool add_multiple_to_entries(string access_token, List<string> entry_ids, List<string> tag_ids)
        {
            string requestUrl = string.Format("{0}/v3/tags/{1}?ct={2}", Configuration.base_url, System.Web.HttpUtility.UrlEncode(string.Join(",", tag_ids)), System.Web.HttpUtility.UrlEncode(Configuration.user_agent));
            Dictionary<string, string> headers = new Dictionary<string, string>();
            headers.Add("Authorization", string.Format("OAuth {0}", access_token));

            json_tagging json = new json_tagging();
            json.entryIds = entry_ids;

            JsonSerializerSettings settings = new JsonSerializerSettings();
            settings.NullValueHandling = NullValueHandling.Ignore;
            string jsonString = JsonConvert.SerializeObject(json, settings);

            Common.HTTPCommunications.Response response = Common.HTTPCommunications.SendPutRequestStringDataOnly(
                            requestUrl,
                            jsonString,
                            headers,
                            true);

            return response.Success;
        }
示例#2
0
        public static bool add_multiple_to_entries(string access_token, List <string> entry_ids, List <string> tag_ids)
        {
            string requestUrl = string.Format("{0}/v3/tags/{1}?ct={2}", Configuration.base_url, System.Web.HttpUtility.UrlEncode(string.Join(",", tag_ids)), System.Web.HttpUtility.UrlEncode(Configuration.user_agent));
            Dictionary <string, string> headers = new Dictionary <string, string>();

            headers.Add("Authorization", string.Format("OAuth {0}", access_token));

            json_tagging json = new json_tagging();

            json.entryIds = entry_ids;

            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.NullValueHandling = NullValueHandling.Ignore;
            string jsonString = JsonConvert.SerializeObject(json, settings);

            Common.HTTPCommunications.Response response = Common.HTTPCommunications.SendPutRequestStringDataOnly(
                requestUrl,
                jsonString,
                headers,
                true);

            return(response.Success);
        }