Giter Club home page Giter Club logo

dataopen-sdk-java's Introduction

openapi 使用说明

Client参数说明

字段 类型 默认值 含义
app_id String 应用的唯一标识符
app_secret String 用于应用的安全认证的密钥
url String 或 null "https://analytics.volcengineapi.com" 服务器的URL地址
expiration String 或 null "1800" 过期时间,单位是秒

client.request参数说明

字段 类型 默认值 含义
service_url String 请求的服务 URL 地址
method String 请求的 HTTP 方法,例如 "GET", "POST" 等
headers Map<String, String> {} 请求头,包含的信息如认证凭据,内容类型等
params Map<String, Object> {} URL 参数,用于GET请求
body Map<String, Object> {} 请求体,通常在POST或PUT请求中包含发送的数据

远程maven地址

https://central.sonatype.com/artifact/io.github.volcengine/dataopen-sdk-java/overview

获取与安装

<dependency>
    <groupId>io.github.volcengine</groupId>
    <artifactId>dataopen-sdk-java</artifactId>
    <version>1.0.4</version>
</dependency>

举例

1、Get 方法

import com.dataopen.sdk.Client;

public class ClientTest {
    @Test
    public void requestGetTest() throws IOException {
        String app_id = "";
        String app_secret = "";

        Client client = new Client(app_id, app_secret);

        Map<String, String> headers = new HashMap<>();

        Map<String, Object> params = new HashMap<>();
        params.put("app", 46);
        params.put("page_size", 2);
        params.put("page", 1);

        Map<String, Object> body = new HashMap<>();

        Map<String, Object> res = client.request("/dataopen/open-apis/xxx/openapi/v1/open/flight-list", "GET", headers, params, body);

        System.out.println("Output requestGetTest: " + res);
    }
}

2、Post 方法

import com.dataopen.sdk.Client;

public class ClientTest {
    @Test
    public void requestPostTest() throws IOException {
        String app_id = "";
        String app_secret = "";

        Client client = new Client(app_id, app_secret);

        Map<String, String> headers = new HashMap<>();

        Map<String, Object> params = new HashMap<>();

        Map<String, Object> body = new HashMap<>();
        body.put("uid_list", new String[] { "1111111110000" });

        Map<String, Object> res = client.request(
                "/dataopen/open-apis/xxx/openapi/v1/open/flight/version/6290880/add-test-user",
                "POST",
                headers,
                params,
                body);

        // Output results
        System.out.println("Output requestPostTest: " + res);
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.