Callback Data API
Back

From WeChat Official Account Admin Platform
Jump to: navigation, search

Through these data APIs, developers can obtain data similar to but more flexible than data provided on the WeChat Official Account Admin Platform web site and then perform additional advanced processing as required.

The Data APIs are only available to developers with a certified official account.

Notes:

1. Official account data provided from the data APIs only includes data after December 1, 2014. Any data provided from  before this date will likely be inaccurate.
2. In order to speed up subsequent user access and reduce API calling time, we suggest developers store data obtained through API calls in their own databases.

Callback data APIs contain API calls used to obtain Callback data from data statistical modules on the WeChat Official Account Admin Platform. The provided APIs are as follows:

API Name Maximum Time Span API Calling URL (https Required)
Obtain Callback data (getinterfacesummary) 30 https://api.weixin.qq.com/datacube/getinterfacesummary?access_token=ACCESS_TOKEN
Obtain Callback data by hour (getinterfacesummaryhour) 1 https://api.weixin.qq.com/datacube/getinterfacesummaryhour?access_token=ACCESS_TOKEN

The maximum time span indicates the maximum time range for obtaining data during one API calling event. For example, if the maximum time span is 7, data from up to 7 days can be obtained once. Please obtain the actual value of access_token through "Access Token".

Request Description

Callback data APIs (including all APIs in the list) should use the HTTP POST method to send parameters to the corresponding API calling URL. A sample set of parameters is provided below:

{ 
    "begin_date": "2014-12-07", 
    "end_date": "2014-12-07"
}

Calling Parameter Description

Parameter Required Description
access_token Yes Access token providing authorization to the calling API
begin_date Yes Start date for queried data. The difference between begin_date and end_date should be less than the maximum time span (for example, if the maximum time span is 1, begin_date and end_date should be identical); otherwise, an error will be reported.
end_date Yes End date for queried data, yesterday's date as the maximum possible value

Return Description

An example of a successful JSON response from the getinterfacesummary API is provided below:

{ 
   "list": [ 
       { 
           "ref_date": "2014-12-07", 
           "callback_count": 36974, 
           "fail_count": 67, 
           "total_time_cost": 14994291, 
           "max_time_cost": 5044
       }
	// Below would be data with ref_date being a value between begin_date and end_date
   ]
}

An example of a successful JSON response from the getinterfacesummaryhour API is provided below:

{ 
   "list": [ 
       { 
           "ref_date": "2014-12-01", 
           "ref_hour": 0, 
           "callback_count": 331, 
           "fail_count": 18, 
           "total_time_cost": 167870, 
           "max_time_cost": 5042
       }
	// Below would be data with the ref_hour incrementing hour-by-hour
   ]
}

Return Parameter Description

Parameter Description
ref_date Date of the data, between begin_date and end_date
ref_hour Hour of the data, from 000 to 2300, indicating from [000,100) (first hour of each day) to [2300,2400) (last hour of each day)
callback_count Number automatic replies sent to followers after receiving messages through the server-configured address
fail_count Number of failures for the above operation
total_time_cost Total time cost (when divided by callback_count you get the average time cost)
max_time_cost Maximum time cost

An error code will be returned upon failure. For details about error codes, please see Return Codes.

Developer Guide
Custom-defined Menu
WeChat JS-SDK