|
| 1 | +""" |
| 2 | +Create App |
| 3 | +
|
| 4 | +Create a new app on the Sunmi AppStore. Before calling this API, you need to: |
| 5 | + 1. Upload the APK -> get apk_uuid (04_upload_apk.py) |
| 6 | + 2. Upload icon/images -> get icon/image UUIDs (05_upload_image.py) |
| 7 | + 3. Get category list -> get cf_id (01_get_classify_list.py) |
| 8 | + 4. Get terminal list -> get terminal names (02_get_terminal_list.py) |
| 9 | + 5. Get language list -> get lan_id (03_get_language_list.py) |
| 10 | +
|
| 11 | +API: POST /v2/appstore/appstore/app/createApp |
| 12 | +Doc (zh-CN): https://developer.sunmi.com/docs/zh-CN/cdixeghjk491/xmrfeghjk535 |
| 13 | +Doc (en-US): https://developer.sunmi.com/docs/en-US/cdixeghjk491/xmrfeghjk535 |
| 14 | +""" |
| 15 | + |
| 16 | +import json |
| 17 | +import os |
| 18 | + |
| 19 | +from client import SunmiAppStoreClient |
| 20 | + |
| 21 | +client = SunmiAppStoreClient( |
| 22 | + app_id=os.environ["SUNMI_APP_ID"], |
| 23 | + app_key=os.environ["SUNMI_APP_KEY"], |
| 24 | +) |
| 25 | + |
| 26 | +response = client.post("/v2/appstore/appstore/app/createApp", { |
| 27 | + "app_name": "Your App Name", |
| 28 | + "icon_url_uuid": "YOUR_ICON_UUID", |
| 29 | + "pic_vertical_screen_uuid": [ |
| 30 | + "YOUR_SCREENSHOT_UUID_1", |
| 31 | + "YOUR_SCREENSHOT_UUID_2", |
| 32 | + "YOUR_SCREENSHOT_UUID_3", |
| 33 | + ], |
| 34 | + # "pic_horizontal_screen_uuid": ["YOUR_HSCREENSHOT_UUID"], # optional |
| 35 | + "apk_uuid": "YOUR_APK_UUID", |
| 36 | + "app_introduction": "A brief description of your app (10-1000 characters).", |
| 37 | + "cf_id": "YOUR_CATEGORY_ID", # from Get App Category List API |
| 38 | + "terminals": ["P2", "V3"], # from Get Terminal List API |
| 39 | + "area": [1, 2, 3], # 1: Mainland China, 2: HK/MO/TW, 3: Overseas |
| 40 | + "range": 0, # 0: visible to all, 1: visible to own channel only |
| 41 | + "deployment_type": 1, # 1: full deployment, 2: gray deployment |
| 42 | + "language": [ # multilingual app names (optional) |
| 43 | + {"lan_id": "YOUR_LAN_ID", "name": "App Name in English"}, |
| 44 | + ], |
| 45 | + "language_introduction": [ # multilingual descriptions (optional) |
| 46 | + {"lan_id": "YOUR_LAN_ID", "introduction": "App description in English"}, |
| 47 | + ], |
| 48 | + "remarks": "Remarks for the reviewer (10-200 characters).", |
| 49 | + # "notify_url": "https://example.com/your-callback", # optional audit result callback URL |
| 50 | + "pond_type": 0, # 0: public store, 1: private store |
| 51 | + |
| 52 | + # --- Gray deployment params (only when deployment_type=2) --- |
| 53 | + # "gray_msn_list": ["MSN1", "MSN2"], |
| 54 | + # "gray_version": 0, # 0: default gray, 2: percentage-based gray |
| 55 | + # "gray_ppm": 10000, # gray ratio, 10000 = 1% (only when gray_version=2) |
| 56 | + # "gray_entity_id_list": ["entity1"], |
| 57 | + # "gray_start_time": 1700000000, # unix timestamp |
| 58 | + # "gray_time_zone": "Asia/Shanghai", |
| 59 | + # "deploy_location_id_list": ["CN"], |
| 60 | +}) |
| 61 | + |
| 62 | +print(json.dumps(response, indent=4, ensure_ascii=False)) |
0 commit comments