@smbcloud / smbcloud-ascapi Mirror · read-only
Fork 0

Read-only mirror of github.com/smbcloudXYZ/smbcloud-ascapi.

Mirrored from https://github.com/smbcloudXYZ/smbcloud-ascapi.git

Synced Nov 25, 09:15 UTC

1 # Xiaomi GetApps
2
3 `asc xiaomi` calls the GetApps developer interface on
4 `global.developer.mi.com/third-api/…`. Each request is signed with HMAC-SHA1
5 using the app's App Secret. Xiaomi documents two endpoints publicly: the
6 order query and the APK upload address. The rest of the upload and the
7 submission are documented on a private Xiaomi wiki, so the listing, the APK
8 upload and the review submission still happen in the console.
9
10 ## Credentials
11
12 The App ID and App Secret are per app: open the app in the console and click
13 the eye icon next to them. The email, developer id and Xiaomi user id belong
14 to the developer account, and GetApps checks that they all match. Put them in
15 a dotenv file, pass it with `--xiaomi-env` or `XIAOMI_ENV_PATH`, or export
16 the variables:
17
18 ```bash
19 XIAOMI_APP_ID=...
20 XIAOMI_APP_SECRET=...
21 XIAOMI_PACKAGE=com.example.app
22 XIAOMI_EMAIL=... # the developer account's email
23 XIAOMI_DEVELOPER_ID=... # a number
24 XIAOMI_USER_ID=... # the Xiaomi account id, a number
25 ```
26
27 The App Secret is never printed, and `--dry-run` withholds the signature too.
28
29 ## Commands
30
31 ```bash
32 asc xiaomi upload-url # credentials and signature check
33 asc xiaomi orders --start 2026-11-01 --end 2026-11-19 # up to 30 days, UTC dates or Unix seconds
34 asc xiaomi orders --start 2026-11-01 --end 2026-11-19 --pay-status 2,6 --regions ES,RO
35 asc --dry-run xiaomi orders --start 2026-11-01 --end 2026-11-19 # print the signed request, send nothing
36 ```
37
38 `upload-url` fetches the address and uploads nothing. Signed URLs in the answer
39 are cut to scheme, host and path.
40
41 `orders` only works once Xiaomi has allowlisted the account. Ask
42 overseas-dev@xiaomi.com. Until then GetApps answers code 999 with "does not
43 have /third-api/order/v1/query permission". The limit is one request a second.
44
45 ## Error codes
46
47 | Code | Meaning |
48 |---|---|
49 | 999 | A header is missing or wrong, the ids don't belong together, or the account lacks permission for the endpoint |
50 | 1001 | No App Secret found for the App ID |
51 | 1002 | Signature mismatch. Xiaomi's docs spell the label both `Timestamp:` and `TimeStamp:`; `asc` signs `Timestamp:`, as both worked examples do |
52 | 3001 | The timestamp is more than 30 minutes old: check the clock |
53 | 3002 | Duplicate nonce |
54
55 ## Publishing without the API
56
57 For an app that is also on Google Play, Xiaomi asks for a PSV build: the same
58 package name, the same signing key as Play (Google's app signing key, not
59 your upload key) and a higher versionCode than Play's. To get an APK signed
60 with Google's key, upload the bundle to Play's internal testing track as a
61 draft, then download the signed universal APK from the App bundle explorer.