# Uploading Mini Program Code
A third-party platform can get template_id by Adding the Draft to the Code Template Library or selecting a code template from the Code Template Library, and then call this API to upload code for an authorized Mini Program.
# Request Address
POST https://api.weixin.qq.com/wxa/commit?access_token=ACCESS_TOKEN
# Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| access_token | String | Yes | Mini Program API Call Token |
| template_id | String | Yes | ID of the code template in the code library |
| ext_json | String | Yes | Custom Configuration from a Third Party |
| user_version | String | Yes | Code version number. It can be defined by developers and contain a maximum of 64 characters. |
| user_desc | String | Yes | Code description. It can be defined by developers. |
POST data example
{
"template_id": 0,
"ext_json": "{\"extAppid\":\"\",\"ext\":{\"attr1\":\"value1\",\"attr2\":\"value2\"},\"extPages\":{\"index\":{},\"search/index\":{}},\"pages\":[\"index\",\"search/index\"],\"window\":{},\"networkTimeout\":{},\"tabBar\":{}}",
"user_version": "V1.0",
"user_desc": "test"
}
- To use the same Mini Program template to provide services for different Mini Programs, a third party can store custom information in ext_json. In a template Mini Program, the
wx.getExtConfigSyncAPI can be called to obtain the custom information. In this way, different Mini Programs are differentiated. For more information, see Developing a Mini Program Template. - Parameters in ext_json are optional. For more information about the parameters, see Mini Program Configurations.
- If the code contains existing configurations, configurations are combined according to the following rule: Overwrite the existing configurations of pages and tabBar.list. For other configurations, insert the configurations, or overwrite the configurations at the same level.
- Configuration of plugins is not supported in ext_json.
- Configuration of pages is partially supported in ext_json. You can configure subsets for template pages, but cannot add pages in ext_json.
- Configuration of subPackages is partially supported in ext_json. You can configure template subpackages and subsets of template pages. The subpackages to be configured in ext_json must be declared in the template first, and no subpackage pages can be added.
Special fields:
| Parameter | Description |
|---|---|
| ext | Defines custom fields. It can be called within Mini Programs. |
| extPages | Page configuration |
| extAppid | Authorizer's AppID. Merchants' AppIDs can be entered to distinguish between different merchants. |
| sitemap | Configures whether a Mini Program and its pages can be indexed by Weixin. |
# Response Parameters
| Parameter | Type | Description |
|---|---|---|
| errcode | number | Error code |
| errmsg | string | Error message |
Example of returned result
{
"errcode": 0,
"errmsg": "ok"
}
# Error Codes
| Error Code | Description |
|---|---|
| -1 | The system is busy. |
| 85013 | The custom configuration is invalid. |
| 85014 | The template ID is invalid. |
| 85043 | The template is incorrect. |
| 85044 | The code package exceeded the size limit. |
| 85045 | A non-existent path is contained in ext_json. |
| 85046 | No path is contained in tabBar. |
| 85047 | The pages field is empty. |
| 85048 | The ext_json field failed to be parsed. |
| 80082 | You have no permission to use this plug-in. |
| 80067 | The plug-in is not found. |
| 80066 | The plug-in version is invalid. |