Java

Java Using OkHttp Library

1
OkHttpClient client = new OkHttpClient();
2
3
MediaType mediaType = MediaType.parse("application/json");
4
RequestBody body = RequestBody.create(mediaType, "{\"token\":\"c2a0b6221c5dd55ceb09ae1f74e46521756d\",\"priority \":0,\"application\":\"2\",\"sleep\":0,\"globalmessage\":\"\",\"globalmedia\":\"\",\"data\":[{\"number\":\"1212\",\"message\":\"Test\"}]}");
5
Request request = new Request.Builder()
6
.url("https://pickyassist.com/app/api/v2/push")
7
.post(body)
8
.addHeader("content-type", "application/json")
9
.build();
10
11
Response response = client.newCall(request).execute();
Copied!

Java Using Unirest Library

1
HttpResponse<String> response = Unirest.post("https://pickyassist.com/app/api/v2/push")
2
.header("content-type", "application/json")
3
.body("{\"token\":\"c2a0b6221c5dd55ceb09ae1f74e46521756d\",\"priority \":0,\"application\":\"2\",\"sleep\":0,\"globalmessage\":\"\",\"globalmedia\":\"\",\"data\":[{\"number\":\"1212\",\"message\":\"Test\"}]}")
4
.asString();
Copied!
Last modified 2yr ago