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

其他配置

最近更新时间2022.08.03 11:07:54

首次发布时间2022.08.03 11:07:54

本文为您提供了服务端 Java SDK 的其他配置模块相关的 API 调用示例。主要包含:获取回调事件、添加回调订阅地址等。

初始化

使用前请先完成初始化,参考初始化

获取回调事件

接口请求参数和返回参数详见 OpenAPI:获取回调事件

package com.volcengine.example.vod.callback;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodSetCallbackEventDemo {

    public static void main(String[] args) throws Exception {
        IVodService vodService = VodServiceImpl.getInstance();
        vodService.setAccessKey("your ak");
        vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodSetCallbackEventRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodSetCallbackEventRequest.newBuilder();
			reqBuilder.setSpaceName("your SpaceName");
			reqBuilder.setEvents("your Events");
			reqBuilder.setAuthEnabled("your AuthEnabled");
			reqBuilder.setPrivateKey("your PrivateKey");
			
            com.volcengine.service.vod.model.response.VodSetCallbackEventResponse resp = vodService.setCallbackEvent(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

添加回调订阅地址

接口请求参数和返回参数详见 OpenAPI:添加回调订阅地址

package com.volcengine.example.vod.callback;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodAddCallbackSubscriptionDemo {

    public static void main(String[] args) throws Exception {
        IVodService vodService = VodServiceImpl.getInstance();
        vodService.setAccessKey("your ak");
        vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodAddCallbackSubscriptionRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodAddCallbackSubscriptionRequest.newBuilder();
			reqBuilder.setSpaceName("your SpaceName");
			reqBuilder.setUrl("your Url");
			reqBuilder.setContentType("your ContentType");
			
            com.volcengine.service.vod.model.response.VodAddCallbackSubscriptionResponse resp = vodService.addCallbackSubscription(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}