You need to enable JavaScript to run this app.
导航

关注

最近更新时间2023.02.28 17:57:49

首次发布时间2021.10.18 11:12:18

调用该接口,建立用户和作者之间的关注关系。

请求方式

请求方法

GET/POST(Content-Type: application/x-www-form-urlencoded)

请求url

https://mercury.volcengineapi.com/?Action=FollowAction&Version=2021-01-01

请求header

ServiceName:content

请求参数

参数描述类型是否必填说明
Partner渠道号String
AccessToken用户唯一标识String
ToUserId作者idString被关注作者的唯一标识

Source

关注来源

int

41:列表页
30:图文详情页
31:短视频详情页
92:小视频详情页
25:个人主页

FromGid从哪条内容上点击的关注String

响应参数

参数描述类型说明
Result返回结果Stringsuccess:成功

请求示例

public static void main(String[] args) {
    //初始化一个service
    StreamConsumerService streamConsumerService = StreamConsumerServiceImpl.getInstance();

    //设置ak,sk 此为请求的凭证
    streamConsumerService.setAccessKey("ak");
    streamConsumerService.setSecretKey("sk");
    //初始化一个request
    FollowActionRequest req = new FollowActionRequest();
    req.setTimestamp(LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")));
    req.setAccessToken("accessToken");
    req.setPartner("partner");
    req.setToUserId("xxxxx");
    try {
        FollowActionResponse response = streamConsumerService.followAction(req);
        System.out.println(JSON.toJSONString(response));
    } catch (Exception e) {
        e.printStackTrace();
    }
}

响应示例

{
    "ResponseMetadata":{
        "Action":"FollowAction",
        "Region":"cn-north-1",
        "RequestId":"202210281739180101510832240F00D034",
        "Service":"content",
        "Version":"2021-01-01"
    },
    "Result":"success"
}