# Creating an Ad Unit
Interface should be called on the server side, seeHattori API。
# Interface Dxplaination
# Interface name
AgencyCreateAdunit
# Functional description
this API Used to create an ad unit for the Mini Program. If you encounter problems during use, you canOpen Platform Service Provider Zone Exchange Zone | WeChat Open CommunityPosting exchanges.
# Note
Where access_Token forauthorizer_access_Token
# Calling mode
# HTTPS call
POST https://api.weixin.qq.com/wxa/operationams?action=agency_create_adunit&access_token=xxxxxxxxxxxxxxx
# Request parameters
attribute | type | Required | Introductions |
---|---|---|---|
name | string | yes | Advertising Unit Name |
type | string | yes | Ad Unit Type |
video_duration_min | number | no | Incentive video ads are required to fill in the minimum value of advertising display time. Currently Available Value: 6 |
video_duration_max | number | no | Incentive video ads are required to fill in the maximum value of advertising display time. Currently Optional Value: 15/30/60 |
TMPL_type | number | no | Template required tmpl_type或tmpl_id。 Method 1: tmpl_type Select the fixed template style, the current selectable values: 6 vertical version above below, 7 vertical version above below, 12 vertical version above below overlay A, 13 vertical version of the above picture below superimposed B, 2 banner above below, 3 banner below above, 4 horizontal plate above below superimposed A, 11 horizontal plate above below superimposed B, 9 banner left right, 10 banner right left, 20 banner single, 100001 single grid without animation, 100003 multi-grid without carousel |
TMPL_id | string | no | Template required tmpl_type或tmpl_id。 Way 2: custom create templates, fill in the realization area - native template management custom created template ID. See:Native Template Editing Capabilities Guide |
# Return parameters
attribute | type | Introductions |
---|---|---|
ret | number | Error code |
err_msg | string | Error message |
ad_unit_id | string | Ad Unit ID |
# Other Notes
# Advertisement Type Name Dxplaination
Name of type ad_slot/type) | Type of advertising space |
---|---|
SLOT_ID_WEAPP_BANNER | Mini Program banner |
SLOT_ID_WEAPP_REWARD_VIDEO | Mini Program Motivational Video |
SLOT_ID_WEAPP_INTERSTITIAL | Mini Program Screen Advertising |
SLOT_ID_WEAPP_VIDEO_FEEDS | Mini Program Video Ads |
SLOT_ID_WEAPP_VIDEO_BEGIN | Mini Program video patch ads |
SLOT_ID_WEAPP_COVER | Mini Program cover advertisement (no need to create) directly through the call to set the cover advertisement bit switch state interface Set cover ad position switch status - WeChat open document ) You can go online |
SLOT_ID_WEAPP_TEMPLATE | Mini Program template advertisement |
# Call Example
Example Dxplaination: The banner is wide:
# Sample Request Data
{
"name": "Test Ad Unit,"
"type": "SLOT_ID_WEAPP_BANNER"
}
# Return Data Example
{
"ret": 0,
"err_msg":"",
"ad_unit_id" = "adnit-04a286aed8xxxx"
}
Example Dxplaination: Motivational Video Advertising Space:
# Sample Request Data
{
"name": "Test Ad Unit,"
"type": "SLOT_ID_WEAPP_REWARD_VIDEO " ,
" video_duration_min": 6,
" video_duration_max": 30
}
# Return Data Example
{
"ret": 0,
"err_msg":"",
"ad_unit_id" = "adnit-04a286aed8xxxx"
}
Example Dxplaination: Template advertising space:
# Sample Request Data
{
"name": "Test Ad Unit,"
"type": "SLOT_ID_WEAPP_TEMPLATE",
"tmpl_type": 6
}
# Return Data Example
{
"ret": 0,
"err_msg":"",
"ad_unit_id" = "adnit-04a286aed8xxxx"
}
# Error code
Error code | Error code | Solutions |
---|---|---|
0 | ok | ok |
-202 | Internal error | Can be retried after some time |
1700 | Parameter error | Verify that the input parameters conform to the documentation |
1701 | Parameter error | Verify that the input parameters conform to the documentation |
1735 | The merchant has not completed the agreement signing process | Complete the signing operation |
1737 | Operating too fast | Wait a minute and reoperate |
1803 | Ad Unit Name Repeat | Modify the Ad Unit Name Entered |
1807 | Invalid Flow Master | Turn on the traffic master for this appid through the turn on traffic master interface |
2009 | Invalid Flow Master | Turn on the traffic master for this appid through the turn on traffic master interface |
2056 | The service provider does not open an account in the cash area | Launch services in the monetization area of the third-party platform page |