API Example using curl
PinnedOriginally from ticket #732.
Hi,
I'm trying to upload a new build from a jenkins server via the App47 api with this script:
curl -H "X-Token: xxxxx" -H "Accept: application/json" -X POST https://cirrus.app47.com/apps/537276cb80922a002b005b69/builds -d '{ build :{ platform: "Android", environment: "Test", file_url: "@/bin/JRTTest6.apk", build_file: "JRTTest6.apk"}}'
I'm getting back {"error":""} and I can't figure out what the problem is. No build is uploaded, and changing the file_url to the full url yields the same results. Any help is greatly appreciated.
Best,
Jonathan
Jonathan,
Sorry you are having trouble. The file_url needs to be something we can access so that we can pull it for evaluation and distribution. I don't think curl is expanding "@/bin/JRTTest6.apk" to anything, is it?
Hey Mark,
I'm honestly not sure what it's doing with that. I've also tried "@/var/lib/jenkins/workspace/android_personal_test_1/bin/JRTTest6.apk"
"@/job/android_personal_test_1/ws/bin/JRTTest6.apk"
"@54.187.175.85:8080/job/android_personal_test_1/ws/bin/JRTTest6.apk"
None of them have worked, and all return {"error":""}.
I've seen "@/bin/build.apk" work for another person's upload script but I don't know how to check whether curl is properly expanding this one.
OK, I don't think curl does any expansion like that. Happy to help get curl working for you, but my main question is this: do you want to upload the build file to us, or will you first put it on some server that we'll be able to pull from using http? That will make a difference in the curl syntax.
I'd rather upload it directly to you guys.
That's what we would prefer as well, let me work on a curl example and get back to you shortly.
Awesome, thanks Mark!
Jonathan, please give the following a go, if it works, let us know and I can update our wiki with another example.
curl -v -H "X-Token: xxxxx" -H "Accept: application/json" -X POST https://cirrus.app47.com/api/apps/537276cb80922a002b005b69/builds -F "build[platform]=Android" -F "build[environment]=Test" -F "build[upload]=@build.apk" -F "build[release_notes]=This is the uploaidng of a new build file" -F "build[make_active]=true"
A couple of things to note:
1. The url is https://cirrus.app47.com/api/apps/<id>/builds not https://cirrus.app47.com/apps/<id>/builds.
2. Remember when uploading test builds for Android you need to also specify your test users, theses are generally a subset of your user base that has access to the app. If you click on "Edit" on the "My Apps" page and then go to the "Users" tab, you'll see a Users field and Test Users field. Users can only download production builds, test users can download both. This is for android and windows builds only, we can figure this out on iOS.
3. The default for "build[make_active] is false, so if you want to manually activate builds, then leave that parameter off.
Let us know if you have more questions.
Thanks Mark, I'll give it a go
Hey Mark, everything's working great now. Thanks again for all your help
Please sign in to leave a comment.
Comments
0 comments