# 设置周期性拉取数据

调用本接口可以设置周期性拉取数据。使用过程中如遇到问题,可在开放平台服务商专区发帖交流。 注意:只能第三方调用

# 请求地址

POST https://api.weixin.qq.com/wxa/fetchdatasetting?access_token=TOKEN

# 请求参数说明

参数 类型 必填 说明
access_token String 第三方平台令牌 authorizer_access_token
action String 填"set_period_fetch"
is_period_fetch_open bool 周期性拉取数据是否开启,true开启,false关闭
period_fetch_type Number 数据来源,0: 开发者服务器;1:云函数
period_fetch_url String 数据下载地址,当period_fetch_type=0必填
1、需要将域名先添加到第三方平台的业务域名;2、然后将该域名添加到小程序业务域名;才可以成功设置
period_env String 环境ID,当period_fetch_type=1必填
period_function_name String 函数名,当period_fetch_type=1必填

POST 数据示例:

{
  "action": "set_period_fetch", 
  "is_period_fetch_open": true, 
  "period_fetch_type": 1, 
  "period_env": "test-pfyol", 
  "period_function_name": "login"
}

# 返回参数说明

参数 类型 说明
errcode Number 返回码
errmsg String 错误信息

返回结果示例:

{
  "errcode": 0,
  "errmsg": "ok"
}

# 返回码说明

返回码 说明
0 ok
9410013 无效action
40166 非小程序发起调用
9410014 period_fetch_type无效
9410016 url无效,需为业务域名
9410017 env或function_name无效
其他错误码 请查看全局错误码