You need to enable JavaScript to run this app.
视频点播

视频点播

复制全文
Java SDK
工具服务
复制全文
工具服务

本文为您提供了服务端 Java SDK 的工具服务模块的接口调用示例。

前提条件

调用接口前,请确保您已完成集成 Java SDK

调用示例

获取 IP 归属信息

接口请求参数和返回参数说明详见获取 IP 归属信息

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
import com.volcengine.service.vod.model.request.VodDescribeIPInfoRequest;
import com.volcengine.service.vod.model.response.VodDescribeIPInfoResponse;

public class VodDescribeIpInfoDemo {
    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1"); 
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            VodDescribeIPInfoRequest.Builder input = com.volcengine.service.vod.model.request.VodDescribeIPInfoRequest.newBuilder();
            input.setIps("1.1.1.1,2.2.2.2");
            VodDescribeIPInfoResponse resp = vodService.describeIpInfo(input.build());
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
最近更新时间:2025.12.18 19:02:47
这个页面对您有帮助吗?
有用
有用
无用
无用