Skip to content

Instantly share code, notes, and snippets.

@QAutomatron
Created April 27, 2017 15:23
Show Gist options
  • Save QAutomatron/4547bb5a823ee3651efcf7654af06dcf to your computer and use it in GitHub Desktop.
Save QAutomatron/4547bb5a823ee3651efcf7654af06dcf to your computer and use it in GitHub Desktop.
Download apk from hockey app. need jq installed
#!/bin/bash
BUILD=$1
TOKEN=<hockey-app-token>
APP=<app-id>
VERSION=$(curl \
-H "X-HockeyAppToken: $TOKEN" \
https://rink.hockeyapp.net/api/2/apps/$APP/app_versions \
| jq --arg BUILD "$BUILD" '.app_versions | .[] | select(.version==$BUILD) | .id')
curl -L -o $BUILD.apk https://rink.hockeyapp.net/api/2/apps/$APP/app_versions/$VERSION?format=apk
echo "!!!DONE!!!"
@AchrafAmil
Copy link

I change TOKEN & APP but it only downloads a 48 bytes .apk file.

@TestMagic0989
Copy link

TestMagic0989 commented Jun 5, 2018

@QAutomatron@AchrafAmil
MY .sh file is not working i have only changed TOKEN & APP value:
#!/bin/bash
BUILD=$1
TOKEN=2e
APP=0
*****3
VERSION=$(curl \
-H "X-HockeyAppToken: $TOKEN" \
https://rink.hockeyapp.net/api/2/apps/$APP/app_versions \
| jq --arg BUILD "$BUILD" '.app_versions | .[] | select(.version==$BUILD) | .id')
curl -L -o $BUILD.apk https://rink.hockeyapp.net/api/2/apps/$APP/app_versions/$VERSION?format=apk
echo "!!!DONE!!!"

I am getting below error:
$ bash /cygdrive/d/appDownload.sh
/cygdrive/d/appDownload.sh: command substitution: line 12: syntax error near unexpected token |' /cygdrive/d/appDownload.sh: command substitution: line 12: | jq --arg BUILD'"$BUILD" '.app_versions | .[] | select(.version==$BUILD) | .id')
/cygdrive/d/appDownload.sh: line 9: curl: command not found
!!!DONE!!!

Could you please help me with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment