Skip to content
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 Aug 26, 2024
b69f81d
grammar fix
burakberkkeskin Aug 26, 2024
93ab60b
added a caution line and changed URLs
burakberkkeskin Aug 26, 2024
097a412
updated self-hosted URLs to prod cloud URLs
burakberkkeskin Sep 2, 2024
8397825
changed access token to api token
burakberkkeskin Sep 4, 2024
2e83701
add description for pat
burakberkkeskin Sep 4, 2024
4bcdf6e
added meanings of the variables
burakberkkeskin Sep 4, 2024
f51df0e
changed url types
burakberkkeskin Sep 4, 2024
5573ae5
minor typo
hiilhan Sep 4, 2024
7e1832e
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 4, 2024
b2970cb
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 4, 2024
3061120
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 5, 2024
fa21a46
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 5, 2024
9ad51da
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 5, 2024
667b9d9
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 5, 2024
eb67d76
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 5, 2024
1d4a443
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 5, 2024
24b58d3
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 6, 2024
06ed113
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 6, 2024
d977f3d
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 6, 2024
7148267
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 6, 2024
c77e706
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 6, 2024
bb7df8b
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 6, 2024
8ab79af
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 10, 2024
84bfa71
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 11, 2024
bcf3c17
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 12, 2024
659cb08
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 12, 2024
b1ad35e
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 12, 2024
122f5c1
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 13, 2024
3e1614e
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 13, 2024
f79c78a
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 13, 2024
f58ff60
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 13, 2024
8d388f2
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 13, 2024
6a19a21
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 13, 2024
f8b3eff
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 16, 2024
d162bf0
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 16, 2024
dd615a6
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 17, 2024
014248c
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 17, 2024
1836feb
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 18, 2024
de3a3d2
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 18, 2024
180dfa1
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 18, 2024
7ca3bb9
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 19, 2024
cb291aa
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 20, 2024
f038072
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 20, 2024
937ef38
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 20, 2024
344ad83
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 20, 2024
b107204
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 20, 2024
85048ce
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 24, 2024
5aec92d
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 24, 2024
974a61d
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 25, 2024
0193c82
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 26, 2024
e4acd06
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 26, 2024
f321d89
Auto merge by autoupdate action 🤖
github-actions[bot] Sep 30, 2024
af084ba
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 1, 2024
ef711d7
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 2, 2024
90f7185
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 2, 2024
a9938a6
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 4, 2024
830faa7
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 4, 2024
5315156
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 7, 2024
0f8eb78
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 9, 2024
138c402
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 9, 2024
eb2f237
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 9, 2024
b0dbd89
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 9, 2024
4d8bc0b
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 10, 2024
eb6e288
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 11, 2024
ee48599
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 15, 2024
792330c
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 15, 2024
5cfe37d
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 15, 2024
e4bba9f
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 16, 2024
8c40b7c
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 18, 2024
67f8b04
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 21, 2024
844e84b
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 21, 2024
de19f6e
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 23, 2024
593ba16
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 23, 2024
c4283f0
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 25, 2024
d7a93ac
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 28, 2024
56be00f
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 30, 2024
6bf8ded
Auto merge by autoupdate action 🤖
github-actions[bot] Oct 30, 2024
60c304d
Auto merge by autoupdate action 🤖
github-actions[bot] Nov 4, 2024
896afbc
Auto merge by autoupdate action 🤖
github-actions[bot] Nov 4, 2024
fae5cef
Auto merge by autoupdate action 🤖
github-actions[bot] Nov 4, 2024
37fe6aa
Auto merge by autoupdate action 🤖
github-actions[bot] Nov 4, 2024
8249c2b
Auto merge by autoupdate action 🤖
github-actions[bot] Nov 5, 2024
6fc522a
Auto merge by autoupdate action 🤖
github-actions[bot] Nov 5, 2024
e87b368
Auto merge by autoupdate action 🤖
github-actions[bot] Nov 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 236 additions & 0 deletions docs/appcircle-api/faq.md
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>

Comment thread
hiilhan marked this conversation as resolved.
:::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.
:::