package example;import org.apache.http.HttpHost;import org.apache.http.client.fluent.\*;public class Example { public static void main(String[] args) throws Exception { String body = "{\"ip\":\"1.2.1.2\"}"; String res =Executor.newInstance() .addHeader("Authorization", "API key") .execute(Request.Put("http://127.0.0.1:22999/api/wip") .bodyString(body, ContentType.APPLICATION_JSON)) .returnContent() .asString(); System.out.println(res) }}
using System;using System.Net;using System.Net.Http;using System.Net.Http.Headers;public class Program { public static async Task Main() { var client = new HttpClient(); var requestMessage = new HttpRequestMessage { Method = HttpMethod.Put, RequestUri = new Uri("http://127.0.0.1:22999/api/wip"), Headers = {{"Authorization", "API key"}}, Content = new StringContent(JsonConvert.SerializeObject(new { ip = "1.2.1.2" }), Encoding.UTF8, "application/json") }; var response = await client.SendAsync(requestMessage); var responseString = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseString); }}
package example;import org.apache.http.HttpHost;import org.apache.http.client.fluent.\*;public class Example { public static void main(String[] args) throws Exception { String body = "{\"ip\":\"1.2.1.2\"}"; String res =Executor.newInstance() .addHeader("Authorization", "API key") .execute(Request.Put("http://127.0.0.1:22999/api/wip") .bodyString(body, ContentType.APPLICATION_JSON)) .returnContent() .asString(); System.out.println(res) }}
using System;using System.Net;using System.Net.Http;using System.Net.Http.Headers;public class Program { public static async Task Main() { var client = new HttpClient(); var requestMessage = new HttpRequestMessage { Method = HttpMethod.Put, RequestUri = new Uri("http://127.0.0.1:22999/api/wip"), Headers = {{"Authorization", "API key"}}, Content = new StringContent(JsonConvert.SerializeObject(new { ip = "1.2.1.2" }), Encoding.UTF8, "application/json") }; var response = await client.SendAsync(requestMessage); var responseString = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseString); }}
package example;import org.apache.http.HttpHost;import org.apache.http.client.fluent.\*;public class Example { public static void main(String[] args) throws Exception { String body = "{\"ip\":\"1.2.1.2\"}"; String res =Executor.newInstance() .addHeader("Authorization", "API key") .execute(Request.Put("http://127.0.0.1:22999/api/wip") .bodyString(body, ContentType.APPLICATION_JSON)) .returnContent() .asString(); System.out.println(res) }}
using System;using System.Net;using System.Net.Http;using System.Net.Http.Headers;public class Program { public static async Task Main() { var client = new HttpClient(); var requestMessage = new HttpRequestMessage { Method = HttpMethod.Put, RequestUri = new Uri("http://127.0.0.1:22999/api/wip"), Headers = {{"Authorization", "API key"}}, Content = new StringContent(JsonConvert.SerializeObject(new { ip = "1.2.1.2" }), Encoding.UTF8, "application/json") }; var response = await client.SendAsync(requestMessage); var responseString = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseString); }}