Android Question API request (GET) with token

h4an

Member
Licensed User
Longtime User
I'm sorry I have to write this thread. I have looked at several API threads to figure out how to make this API GET work in B4A. Copied from Postman:

OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://airsports.no/api/v1/contests/")
.method("GET", body)
.addHeader("Authorization", "Bearer .....................")
.build();
Response response = client.newCall(request).execute();

Some code exampel in B4A please.
 

h4an

Member
Licensed User
Longtime User
Thankyou airec, now I have to figure out how to take care of the response data maybe I will return with a more questions.
 
Upvote 0
Top