I'll try being as detailed as I possibly can. Please excuse any formatting or language issues.
What I'm trying to do?
I'm trying to make an app to upload APKs to Appcenter to execute UI test cases on whatever devices a user provided. When finished, my app will show the results of the UI tests executed.
How am I doing it?
App center has provided a lot of APIs which may be viewed here. Executing a UI test is a 4 step process.
- Create a new test run. This is working
- Create hashses of files to be uploaded. This is working
- Upload the actual files. I keep getting a 400 bad request OR "payload is too big" error. My APK file is only 1 MB & the upload works through Appcenter CLI.
- Execute the test run created. This API is not working. Probably due to failure of 3rd step.
What do I need help with?
Step 3. above is not working for me. I keep getting the following error when I try to upload the APK file through curl/postman.
Curl command :
curl -i -F "data=@app-debug-androidTest.apk" -H "X-API-Token:API_TOKEN_HERE" -H "Content-Type:application/json" -X POST https://api.appcenter.ms/v0.1/apps/{ORG_NAME}/{APP_NAME}/test_runs/{TEST_RUN_ID_CREATED_IN_STEP_1}/files
Error received :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Payload Too Large</pre>
</body>
</html>
The irony is, when the exact same API is executed by the Appcenter CLI, it works. If UI tests are executed as part of the build step, App center uses the exact same procedure & set of APIs to upload the APK. Please view the complete log here. For formatting purposes, I did not add in inline.
What am I doing wrong?