hi, how to write this in b4a code, thanks
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.send.com/starter/province?id=12")
.get()
.addHeader("key", "your-api-key")
.build();
Response response = client.newCall(request).execute();
and
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "origin=501&destination=114&weight=1700&courier=goexpress");
Request request = new Request.Builder()
.url("https://api.send.com/starter/cost")
.post(body)
.addHeader("key", "your-api-key")
.addHeader("content-type", "application/x-www-form-urlencoded")
.build();
Response response = client.newCall(request).execute();
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.send.com/starter/province?id=12")
.get()
.addHeader("key", "your-api-key")
.build();
Response response = client.newCall(request).execute();
and
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "origin=501&destination=114&weight=1700&courier=goexpress");
Request request = new Request.Builder()
.url("https://api.send.com/starter/cost")
.post(body)
.addHeader("key", "your-api-key")
.addHeader("content-type", "application/x-www-form-urlencoded")
.build();
Response response = client.newCall(request).execute();