What is the code for uploading an App to LambdaTest?
Hello Miro,
here is how to upload an app to LambdaTest:
public static void appupload() throws IOException {
String credential = Credentials.basic(userName, accessKey);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("appFile","Location_of_APK_OR_IPA_file",
RequestBody.create(MediaType.parse("application/octet-stream"),
new File("apps/sample.apk")))
.build();
Request request = new Request.Builder()
.url("https://manual-api.lambdatest.com/app/upload/realDevice")
.method("POST", body)
.addHeader("Authorization", credential)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}