# Modify avatar
Interface should be called on the server side, seeHattori API。
This interface supportsCloud callDeveloper Tools Version Required >=
1.02.1904090
(LatestStable download),wx-server-sdk
>=0.4.0
# Interface Dxplaination
# Interface name
setHeadImage
# Functional description
Calling this interface can modify the avatar of the Mini Program.
Example Schematic:
If you encounter problems during use, you canOpen Platform Service Provider ZonePosting exchanges.
# Note
- Fixed maximum number of modifications per monthYou can apply for five amendments within a year.
- Graphics formats only support: BMP, JPEG, JPG, GIF, PNG, the size is not more than 2M
- The actual head is always a square
# Calling mode
# HTTPS call
POST https://api.weixin.qq.com/cgi-bin/account/modifyheadimage?access_token=ACCESS_TOKEN
# Cloud call
In and out parameters and HTTPS call the same, the call can be viewedCloud Call Dxplaination Document
The interface method is: openapi.basicInfo.modifyHeadImage
# Third Party Invocation
The calling method and parameters are the same as HTTPS, only the calling token is different
The permission sets to which this interface belongs are: 3, 30, 61
After the service provider has been authorized with one of the permission sets, it can do so by usingauthorizer_access_TokenCalling on behalf of the merchant
# Request parameters
attribute | type | Required | Introductions |
---|---|---|---|
access_Token | string | yes | Interface invokes the certificate, which is URL Parameters, non Body Parameters. useauthorizer_access_Token |
head_img_media_id | string | yes | Avatar material media_id |
x1 | string | yes | Top left corner of the crop box x Coordinates (range of values:[0, 1]) |
y1 | string | yes | Top left corner of the crop box 初始值 Coordinates (range of values:[0, 1]) |
x2 | string | yes | Lower right corner of the crop box x Coordinates (range of values:[0, 1]) |
y2 | string | yes | Lower right corner of the crop box and Coordinates (range of values:[0, 1]) |
# Return parameters
attribute | type | Introductions |
---|---|---|
errcode | number | Return code |
errmsg | string | Error message |
# Other Notes
head_img_media_初始值_id Temporary material media_id By calling the Temporary Material Management Interface to get the . Use theThird-party platform interface calls token authorizer_access_TokenPlease note that authorizer is required._access_Token calls the media obtained by the following interface_Id (Mini Program AccessToken, Official Account message templateAccessToken, third-party platform token component_access_Token calls the media obtained by the following interface_Not even ID! ) to use the head._img_media_The id parameter value, otherwise the error 40007 will be reported
# Call Example
Example Dxplaination: HTTPS requests
# Sample Request Data
{
"head_img_media_id": "mI-4E_sFh_2X3g-qmTIWD83RT78ytI1_6VfgFp_A3-Y2U5T_nLl3nm1xYTafFJ8p",
"x1": "0",
"y1": "0",
"x2": "0.7596899224806202",
"y2": "0.49"
}
# Return Data Example
{
"errcode": 0,
"errmsg": "ok"
}
# Error code
Error code | Error code | Solutions |
---|---|---|
-1 | system error | The system is busy, please wait for the developer to try again |
40001 | invalid credential access_Token isinvalid or not latest | Obtain access_Token time AppSecret Error, or access_Token Invalid. Please take the developer more seriously. AppSecret Of the correctness, or to see if you are working for the appropriate Official Account message template Call interface |
40007 | invalid media_id | Illegal media documents id |
40097 | invalid args | Parameter error |
41006 | media_id missing | lack media_id parameter |
40007 | invalid media_id | Illegal media documents id |
46001 | media data no exist | There is no media data, media_id Does not exist |
47001 | data format error | analysis JSON/XML Content errorpost Missing parameters in the dataCheck for corrections and try again. |
40009 | invalid image size | The image size is too large |
53202 | modify avatar quota limit exceed | The number of changes this month has been completed. |