コード例 #1
0
        public static async Task PutMicroleavesGEOsIps(string APIDomain, string Membership, string Token, string geos)
        {
            string url = MicroProxyConnector.APILinkBuilder(APIDomain, Membership, Token, MicroProxyConnector.GeosEndPoint);
            //geo": [ "us", "gb" ],
            var payload = new StringContent($"{{\"geo\": [\"us\"],\"advanced_geo\": [{geos}]}}", Encoding.UTF8, "application/json");

            using (HttpResponseMessage response = await APIController.ApiClient.PutAsync(url, payload))
            {
                if (response.IsSuccessStatusCode)
                {
                    MessageBox.Show("Success Update GEOs", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    throw new Exception(response.ReasonPhrase);
                }
            }
        }
コード例 #2
0
        public static async Task <JObject> GetMicroleavesGEOs(string APIDomain, string Membership, string Token)
        {
            string url = MicroProxyConnector.APILinkBuilder(APIDomain, Membership, Token, MicroProxyConnector.GeosEndPoint);

            using (HttpResponseMessage response = await APIController.ApiClient.GetAsync(url))
            {
                if (response.IsSuccessStatusCode)
                {
                    JObject data = await response.Content.ReadAsAsync <JObject>();

                    return(data);
                }
                else
                {
                    throw new Exception(response.ReasonPhrase);
                }
            }
        }