-
Notifications
You must be signed in to change notification settings - Fork 10
#BE-4302 Added FAQ for Downloading App Version #618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
burakberkkeskin
wants to merge
85
commits into
develop
Choose a base branch
from
feature/BE-4302
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
0a96983
added faq for API
burakberkkeskin b69f81d
grammar fix
burakberkkeskin 93ab60b
added a caution line and changed URLs
burakberkkeskin 097a412
updated self-hosted URLs to prod cloud URLs
burakberkkeskin 8397825
changed access token to api token
burakberkkeskin 2e83701
add description for pat
burakberkkeskin 4bcdf6e
added meanings of the variables
burakberkkeskin f51df0e
changed url types
burakberkkeskin 5573ae5
minor typo
hiilhan 7e1832e
Auto merge by autoupdate action 🤖
github-actions[bot] b2970cb
Auto merge by autoupdate action 🤖
github-actions[bot] 3061120
Auto merge by autoupdate action 🤖
github-actions[bot] fa21a46
Auto merge by autoupdate action 🤖
github-actions[bot] 9ad51da
Auto merge by autoupdate action 🤖
github-actions[bot] 667b9d9
Auto merge by autoupdate action 🤖
github-actions[bot] eb67d76
Auto merge by autoupdate action 🤖
github-actions[bot] 1d4a443
Auto merge by autoupdate action 🤖
github-actions[bot] 24b58d3
Auto merge by autoupdate action 🤖
github-actions[bot] 06ed113
Auto merge by autoupdate action 🤖
github-actions[bot] d977f3d
Auto merge by autoupdate action 🤖
github-actions[bot] 7148267
Auto merge by autoupdate action 🤖
github-actions[bot] c77e706
Auto merge by autoupdate action 🤖
github-actions[bot] bb7df8b
Auto merge by autoupdate action 🤖
github-actions[bot] 8ab79af
Auto merge by autoupdate action 🤖
github-actions[bot] 84bfa71
Auto merge by autoupdate action 🤖
github-actions[bot] bcf3c17
Auto merge by autoupdate action 🤖
github-actions[bot] 659cb08
Auto merge by autoupdate action 🤖
github-actions[bot] b1ad35e
Auto merge by autoupdate action 🤖
github-actions[bot] 122f5c1
Auto merge by autoupdate action 🤖
github-actions[bot] 3e1614e
Auto merge by autoupdate action 🤖
github-actions[bot] f79c78a
Auto merge by autoupdate action 🤖
github-actions[bot] f58ff60
Auto merge by autoupdate action 🤖
github-actions[bot] 8d388f2
Auto merge by autoupdate action 🤖
github-actions[bot] 6a19a21
Auto merge by autoupdate action 🤖
github-actions[bot] f8b3eff
Auto merge by autoupdate action 🤖
github-actions[bot] d162bf0
Auto merge by autoupdate action 🤖
github-actions[bot] dd615a6
Auto merge by autoupdate action 🤖
github-actions[bot] 014248c
Auto merge by autoupdate action 🤖
github-actions[bot] 1836feb
Auto merge by autoupdate action 🤖
github-actions[bot] de3a3d2
Auto merge by autoupdate action 🤖
github-actions[bot] 180dfa1
Auto merge by autoupdate action 🤖
github-actions[bot] 7ca3bb9
Auto merge by autoupdate action 🤖
github-actions[bot] cb291aa
Auto merge by autoupdate action 🤖
github-actions[bot] f038072
Auto merge by autoupdate action 🤖
github-actions[bot] 937ef38
Auto merge by autoupdate action 🤖
github-actions[bot] 344ad83
Auto merge by autoupdate action 🤖
github-actions[bot] b107204
Auto merge by autoupdate action 🤖
github-actions[bot] 85048ce
Auto merge by autoupdate action 🤖
github-actions[bot] 5aec92d
Auto merge by autoupdate action 🤖
github-actions[bot] 974a61d
Auto merge by autoupdate action 🤖
github-actions[bot] 0193c82
Auto merge by autoupdate action 🤖
github-actions[bot] e4acd06
Auto merge by autoupdate action 🤖
github-actions[bot] f321d89
Auto merge by autoupdate action 🤖
github-actions[bot] af084ba
Auto merge by autoupdate action 🤖
github-actions[bot] ef711d7
Auto merge by autoupdate action 🤖
github-actions[bot] 90f7185
Auto merge by autoupdate action 🤖
github-actions[bot] a9938a6
Auto merge by autoupdate action 🤖
github-actions[bot] 830faa7
Auto merge by autoupdate action 🤖
github-actions[bot] 5315156
Auto merge by autoupdate action 🤖
github-actions[bot] 0f8eb78
Auto merge by autoupdate action 🤖
github-actions[bot] 138c402
Auto merge by autoupdate action 🤖
github-actions[bot] eb2f237
Auto merge by autoupdate action 🤖
github-actions[bot] b0dbd89
Auto merge by autoupdate action 🤖
github-actions[bot] 4d8bc0b
Auto merge by autoupdate action 🤖
github-actions[bot] eb6e288
Auto merge by autoupdate action 🤖
github-actions[bot] ee48599
Auto merge by autoupdate action 🤖
github-actions[bot] 792330c
Auto merge by autoupdate action 🤖
github-actions[bot] 5cfe37d
Auto merge by autoupdate action 🤖
github-actions[bot] e4bba9f
Auto merge by autoupdate action 🤖
github-actions[bot] 8c40b7c
Auto merge by autoupdate action 🤖
github-actions[bot] 67f8b04
Auto merge by autoupdate action 🤖
github-actions[bot] 844e84b
Auto merge by autoupdate action 🤖
github-actions[bot] de19f6e
Auto merge by autoupdate action 🤖
github-actions[bot] 593ba16
Auto merge by autoupdate action 🤖
github-actions[bot] c4283f0
Auto merge by autoupdate action 🤖
github-actions[bot] d7a93ac
Auto merge by autoupdate action 🤖
github-actions[bot] 56be00f
Auto merge by autoupdate action 🤖
github-actions[bot] 6bf8ded
Auto merge by autoupdate action 🤖
github-actions[bot] 60c304d
Auto merge by autoupdate action 🤖
github-actions[bot] 896afbc
Auto merge by autoupdate action 🤖
github-actions[bot] fae5cef
Auto merge by autoupdate action 🤖
github-actions[bot] 37fe6aa
Auto merge by autoupdate action 🤖
github-actions[bot] 8249c2b
Auto merge by autoupdate action 🤖
github-actions[bot] 6fc522a
Auto merge by autoupdate action 🤖
github-actions[bot] e87b368
Auto merge by autoupdate action 🤖
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,236 @@ | ||
| --- | ||
| title: Troubleshooting & FAQ | ||
| description: Troubleshooting & FAQ | ||
| tags: [api, authentication, personal api token, api token, session token, troubleshooting, faq] | ||
| sidebar_position: 5 | ||
| --- | ||
|
|
||
| import Tabs from '@theme/Tabs'; | ||
| import TabItem from '@theme/TabItem'; | ||
|
|
||
| # Overview | ||
|
|
||
| This section is designed to help you quickly find answers to common questions and provide you with a better understanding of Appcircle server API. | ||
|
|
||
| ## Appcircle Server API FAQ | ||
|
|
||
| ### How can I check the versions of an app published in the Enterprise App Store and download it? | ||
|
|
||
| After you have successfully [created the Personal API Token](/appcircle-api/api-authentication.md#generatingmanaging-the-personal-api-tokens) from the **root organization**, you can check the versions of an application and download them, like in the following example code blocks. | ||
|
|
||
| :::caution | ||
| You must create the PAT (Personal API Token) on the root organization. Requests will fail if you create the PAT from a sub-organization. | ||
| ::: | ||
|
|
||
| You should change the required variables for your own needs before using the same code samples. | ||
|
|
||
| If you are a cloud Appcircle server user, you should change the variables below: | ||
|
|
||
| - `PERSONAL_API_TOKEN`: The PAT created from the root organization. | ||
| - `STORE_URL`: The default or custom store URL you use to access your Appcircle Enterprise App Store. | ||
|
|
||
| If you are using the self-hosted Appcircle server, you should change the following variables in addition to the ones above: | ||
|
|
||
| - `API_URL`: The API URL for your self-hosted Appcircle server. If you are accessing Appcircle dashboard with a URL like `https://my.appcircle.spacetech.com`, your `API` URL will usually be `https://api.appcircle.spacetech.com`. | ||
| - `AUTH_URL`: The Authentication URL for your self-hosted Appcircle server. If you are accessing Appcircle dashboard with a URL like `https://my.appcircle.spacetech.com`, your `AUTH` URL will usually be `https://auth.appcircle.spacetech.com`. | ||
|
|
||
| <Tabs | ||
| defaultValue="bash" | ||
| groupId="language" | ||
| values={[ | ||
| {label: 'Bash', value: 'bash'}, | ||
| {label: 'Python', value: 'python'}, | ||
| ]}> | ||
|
|
||
| <TabItem value="bash"> | ||
|
|
||
| <details> | ||
| <summary>Click to see the code block.</summary> | ||
| <p> | ||
|
|
||
| ```bash | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -uo pipefail | ||
|
|
||
| PERSONAL_API_TOKEN="SuperSecretPatTakenFromRootOrganization==" | ||
| # Please be cautious, URLs shouldn't end with '/'. | ||
| API_URL="https://api.appcircle.io" # API URL for Appcircle cloud | ||
| AUTH_URL="https://auth.appcircle.io" # AUTH URL for Appcircle cloud | ||
| STORE_URL="https://mycustomstoredomain.appcircle.io" # Your default or custom store URL on Appcircle cloud. | ||
|
|
||
| echo -e "Authenticating to the $AUTH_URL \n" | ||
| TOKEN_JSON_RESPONSE=$(curl -fs -X POST "${AUTH_URL}/auth/v1/token" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "pat=$PERSONAL_API_TOKEN") | ||
| if [[ "$?" != "0" ]]; then | ||
| echo "Couldn't authenticate to the $API_URL with the PAT." | ||
| echo "Please check your PAT." | ||
| echo "If you are a self-hosted Appcircle user, please change the 'API_URL', 'AUTH_URL' and 'STORE_URL'" | ||
| exit 1 | ||
| fi | ||
|
|
||
| ACCESS_TOKEN=$(echo "$TOKEN_JSON_RESPONSE" | jq -j '.access_token') | ||
|
|
||
| echo -e 'Getting profiles... \n' | ||
|
|
||
| PROFILE_RESPONSE=$( curl -fs "${API_URL}/store/v1/profiles" \ | ||
| -H "authorization: Bearer $ACCESS_TOKEN" | ||
| ) | ||
| if [[ "$?" != "0" ]]; then | ||
| echo "Couldn't get the Enterprise App Store profiles." | ||
| echo "Please check your connection." | ||
| exit 1 | ||
| fi | ||
|
|
||
| PROFILE_ID=$(echo "$PROFILE_RESPONSE" | jq -r '.[0].id') # Get the first element for test responses. You should filter by ids here for your needs. | ||
| echo "Enterprise App Store profile id: $PROFILE_ID" | ||
| echo -e "Getting app versions... \n" | ||
|
|
||
| APP_VERSION_RESPONSE=$( curl -fs "$API_URL/store/v1/profiles/$PROFILE_ID/app-versions?suborg=all" \ | ||
| -H "authorization: Bearer $ACCESS_TOKEN" | ||
| ) | ||
| if [[ "$?" != "0" ]]; then | ||
| echo "Couldn't get versions of the selected Enterprise App Store application." | ||
| echo "Please check your connection." | ||
| exit 1 | ||
| fi | ||
|
|
||
| APP_VERSION_ID=$(echo "$APP_VERSION_RESPONSE" | jq -r '.[0].id') # Get the first element for test responses. You should filter by ids here for your needs. | ||
| APP_OS_TYPE=$(echo "$APP_VERSION_RESPONSE" | jq -r '.[0].platformType') # Get the first element for test responses. You should filter by ids here for your needs. | ||
| APP_OS="" | ||
| APP_OUTPUT_FILE="" | ||
| echo "App version id: $APP_VERSION_ID" | ||
| if [[ "$APP_OS_TYPE" == "1" ]]; then | ||
| APP_OS="ios" | ||
| APP_OUTPUT_FILE="app.plist" | ||
| else | ||
| APP_OS="android" | ||
| APP_OUTPUT_FILE="app.apk" | ||
| fi | ||
| echo "App OS: $APP_OS" # 1 for iOS, 2 for Android. | ||
| echo -e "Getting app download link... \n" | ||
|
|
||
| echo "Downloading the app to the $APP_OUTPUT_FILE file." | ||
| curl -fs --location "$STORE_URL/api/profile/$PROFILE_ID/appversions/$APP_VERSION_ID/download-update" \ | ||
| --header "Authorization: Bearer $ACCESS_TOKEN" \ | ||
| -o "$APP_OUTPUT_FILE" | ||
| ``` | ||
|
|
||
| </p> | ||
| </details> | ||
|
|
||
| </TabItem> | ||
|
|
||
| <TabItem value="python"> | ||
|
|
||
| <details> | ||
| <summary>Click to see the code block.</summary> | ||
| <p> | ||
|
|
||
| ```python | ||
| import requests | ||
| import sys | ||
| import json | ||
|
|
||
| PERSONAL_API_TOKEN = "SuperSecretPatTakenFromRootOrganization==" | ||
| # Please be cautious, URLs shouldn't end with '/'. | ||
| API_URL = "https://api.appcircle.io" # API URL for Appcircle cloud | ||
| AUTH_URL = "https://auth.appcircle.io" # AUTH URL for Appcircle cloud | ||
| STORE_URL = "https://mycustomstoredomain.appcircle.io" # Your default or custom store URL on Appcircle cloud. | ||
|
|
||
| def main(): | ||
| print(f"Authenticating to {AUTH_URL}\n") | ||
| try: | ||
| token_response = requests.post( | ||
| f"{AUTH_URL}/auth/v1/token", | ||
| headers={"accept": "application/json", "Content-Type": "application/x-www-form-urlencoded"}, | ||
| data={"pat": PERSONAL_API_TOKEN} | ||
| ) | ||
| token_response.raise_for_status() | ||
| except requests.exceptions.RequestException as e: | ||
| print(f"Couldn't authenticate to {API_URL} with the PAT.") | ||
| print("Please check your PAT.") | ||
| print("If you are a self-hosted Appcircle user, please change the 'API_URL', 'AUTH_URL', and 'STORE_URL'") | ||
| sys.exit(1) | ||
|
|
||
| access_token = token_response.json().get("access_token") | ||
|
|
||
| print('Getting profiles...\n') | ||
| try: | ||
| profile_response = requests.get( | ||
| f"{API_URL}/store/v1/profiles", | ||
| headers={"authorization": f"Bearer {access_token}"} | ||
| ) | ||
| profile_response.raise_for_status() | ||
| except requests.exceptions.RequestException as e: | ||
| print("Couldn't get the Enterprise App Store profiles.") | ||
| print("Please check your connection.") | ||
| sys.exit(1) | ||
|
|
||
| profiles = profile_response.json() | ||
| if not profiles: | ||
| print("No profiles found.") | ||
| sys.exit(1) | ||
|
|
||
| profile_id = profiles[0].get("id") | ||
| print(f"Enterprise App Store profile id: {profile_id}") | ||
|
|
||
| print("Getting app versions...\n") | ||
| try: | ||
| app_version_response = requests.get( | ||
| f"{API_URL}/store/v1/profiles/{profile_id}/app-versions?suborg=all", | ||
| headers={"authorization": f"Bearer {access_token}"} | ||
| ) | ||
| app_version_response.raise_for_status() | ||
| except requests.exceptions.RequestException as e: | ||
| print("Couldn't get versions of the selected Enterprise App Store application.") | ||
| print("Please check your connection.") | ||
| sys.exit(1) | ||
|
|
||
| app_versions = app_version_response.json() | ||
| if not app_versions: | ||
| print("No app versions found.") | ||
| sys.exit(1) | ||
|
|
||
| app_version_id = app_versions[0].get("id") | ||
| app_os_type = app_versions[0].get("platformType") | ||
| app_os = "ios" if app_os_type == "1" else "android" | ||
| app_output_file = "app.plist" if app_os == "ios" else "app.apk" | ||
|
|
||
| print(f"App version id: {app_version_id}") | ||
| print(f"App OS: {app_os}") # 1 for iOS, 2 for Android. | ||
| print("Getting app download link...\n") | ||
|
|
||
| print(f"Downloading the app to the {app_output_file} file.") | ||
| try: | ||
| download_response = requests.get( | ||
| f"{STORE_URL}/api/profile/{profile_id}/appversions/{app_version_id}/download-update", | ||
| headers={"Authorization": f"Bearer {access_token}"}, | ||
| stream=True | ||
| ) | ||
| download_response.raise_for_status() | ||
| with open(app_output_file, "wb") as f: | ||
| for chunk in download_response.iter_content(chunk_size=8192): | ||
| f.write(chunk) | ||
| except requests.exceptions.RequestException as e: | ||
| print(f"Couldn't download the app: {e}") | ||
| sys.exit(1) | ||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
|
|
||
| ``` | ||
|
|
||
| </p> | ||
| </details> | ||
|
|
||
| </TabItem> | ||
|
|
||
| </Tabs> | ||
|
|
||
| :::tip | ||
| If you are a self-hosted Appcircle server user, you can change the required URL variables for your own needs and use the same method. | ||
| ::: | ||
|
|
||
| :::caution | ||
| Please create the PAT from the root organization. If you do not create it from the sub-organization, you will not be able to download the app versions available in the Enterprise App Store profiles of either the root organization or the organization where you created the PAT. | ||
| ::: | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.