{"id":26067426,"url":"https://github.com/agoraio-community/agora-rest-client-java","last_synced_at":"2025-08-25T07:18:28.226Z","repository":{"id":263798583,"uuid":"891336755","full_name":"AgoraIO-Community/agora-rest-client-java","owner":"AgoraIO-Community","description":"A Java library for integrating with Agora's REST API. This open-source project provides wrappers and implementations for Agora's official REST API, making it easier for developers to integrate Agora's server-side services into their Java applications.","archived":false,"fork":false,"pushed_at":"2025-07-21T02:50:48.000Z","size":1386,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-07-21T04:25:46.554Z","etag":null,"topics":["java","reactor","rest-client"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AgoraIO-Community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-20T06:37:08.000Z","updated_at":"2025-07-21T02:50:52.000Z","dependencies_parsed_at":"2025-03-08T21:44:43.278Z","dependency_job_id":"1fcddebb-8fac-4802-99ea-bcc24e484bb1","html_url":"https://github.com/AgoraIO-Community/agora-rest-client-java","commit_stats":null,"previous_names":["agoraio-community/agora-rest-client-java"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/AgoraIO-Community/agora-rest-client-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgoraIO-Community%2Fagora-rest-client-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgoraIO-Community%2Fagora-rest-client-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgoraIO-Community%2Fagora-rest-client-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgoraIO-Community%2Fagora-rest-client-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AgoraIO-Community","download_url":"https://codeload.github.com/AgoraIO-Community/agora-rest-client-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgoraIO-Community%2Fagora-rest-client-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272022513,"owners_count":24860206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","reactor","rest-client"],"created_at":"2025-03-08T21:44:33.309Z","updated_at":"2025-08-25T07:18:28.218Z","avatar_url":"https://github.com/AgoraIO-Community.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Agora REST Client for Java\n\n\u003cp\u003e\n\u003cimg alt=\"Maven Central Version\" src=\"https://img.shields.io/maven-central/v/io.agora/agora-rest-client-core?colorB=brightgreen\"\u003e\n\u003cimg alt=\"GitHub License\" src=\"https://img.shields.io/github/license/AgoraIO-Community/agora-rest-client-java\"\u003e\n\u003ca href=\"https://github.com/AgoraIO-Community/agora-rest-client-java/actions/workflows/maven.yml\"\u003e\u003cimg alt=\"Java CI with Maven\" src=\"https://github.com/AgoraIO-Community/agora-rest-client-java/actions/workflows/maven.yml/badge.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/AgoraIO-Community/agora-rest-client-java/actions/workflows/gitee-sync.yml\"\u003e\u003cimg alt=\"gitee-sync\" src=\"https://github.com/AgoraIO-Community/agora-rest-client-java/actions/workflows/gitee-sync.yml/badge.svg?branch=main\"\u003e\u003c/a\u003e\n\u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/v/release/AgoraIO-Community/agora-rest-client-java\"\u003e\n\u003cimg alt=\"GitHub Issues or Pull Requests\" src=\"https://img.shields.io/github/issues-pr/AgoraIO-Community/agora-rest-client-java\"\u003e\n\u003c/p\u003e\n\n`agora-rest-client-java`is an open-source project written in Java, specifically designed for the Agora REST API. It includes wrappers and internal implementations of the official Agora REST API interfaces, making it easier for developers to integrate the server-side Agora REST API.\n\nEnglish | [简体中文](./README_ZH.md)\n\n\u003e [!IMPORTANT]\n\u003e This SDK has undergone some testing to ensure its basic functionality works correctly. However, due to the complexity of software development, we cannot guarantee it is completely free of defects. We encourage community developers and users to actively participate and help improve this project.\n\n## Features\n\n-   Encapsulates the request and response handling of the Agora REST API, simplifying the communication process with the Agora REST API.\n-   Provides automatic switching to the best domain in case of DNS resolution failure, network errors, or request timeouts, ensuring the availability of the REST API service.\n-   Offers easy-to-use APIs to easily implement common functions of the Agora REST API, such as starting and stopping cloud recording.\n-   Based on Java language, it is efficient, concurrent, and scalable.\n\n## Supported Services\n\n-   [Cloud Recording](./agora-rest-client-core/src/main/java/io/agora/rest/services/cloudrecording/README.md)\n-   [Conversational AI Engine](./agora-rest-client-core/src/main/java/io/agora/rest/services/convoai/README.md)\n\n## Environment Setup\n\n-   [Java 1.8 or later](https://www.java.com)\n-   App ID and App Certificate obtained from the [Agora Console](https://console.agora.io/v2)\n-   Basic Auth credentials from the [Agora Console](https://console.agora.io/v2)\n-   Enable the relevant service capabilities on the [Agora Console](https://console.agora.io/v2)\n\n## Installation\n\nFirst, add the REST Client dependency in the `pom.xml` file:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.agora\u003c/groupId\u003e\n    \u003cartifactId\u003eagora-rest-client-core\u003c/artifactId\u003e\n    \u003cversion\u003e0.6.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Usage Example\n\nHere is an example of calling the cloud recording service:\n\n```java\npackage com.company.example;\n\nimport io.agora.rest.AgoraException;\nimport io.agora.rest.core.BasicAuthCredential;\nimport io.agora.rest.core.Credential;\nimport io.agora.rest.core.DomainArea;\nimport io.agora.rest.services.cloudrecording.CloudRecordingConfig;\nimport io.agora.rest.services.cloudrecording.api.req.StartResourceReq;\nimport io.agora.rest.services.cloudrecording.api.res.AcquireResourceRes;\nimport io.agora.rest.services.cloudrecording.api.res.StartResourceRes;\nimport io.agora.rest.services.cloudrecording.api.res.StopResourceRes;\nimport io.agora.rest.services.cloudrecording.CloudRecordingClient;\nimport io.agora.rest.services.cloudrecording.scenario.mix.req.AcquireMixRecordingResourceClientReq;\nimport io.agora.rest.services.cloudrecording.scenario.mix.req.StartMixRecordingResourceClientReq;\nimport io.agora.rest.services.cloudrecording.scenario.mix.res.QueryMixHLSAndMP4RecordingResourceRes;\n\nimport java.util.Arrays;\nimport java.util.Collections;\n\npublic class Main {\n    private static String appId = \"\u003cyour appId\u003e\";\n\n    private static String cname = \"\u003cyour cname\u003e\";\n\n    private static String uid = \"\u003cyour uid\u003e\";\n\n    private static String username = \"\u003cthe username of basic auth credential\u003e\";\n\n    private static String password = \"\u003cthe password of basic auth credential\u003e\";\n\n    private static String token = \"\u003cyour token\u003e\";\n\n    private static String accessKey = \"\u003cyour accessKey\u003e\";\n\n    private static String secretKey = \"\u003cyour secretKey\u003e\";\n\n    private static Integer region = 0; // \u003cyour region\u003e\n\n    private static String bucket = \"\u003cyour bucket\u003e\";\n\n    private static Integer vendor = 0; // \u003cyour vendor\u003e\n\n    public static void main(String[] args) throws Exception {\n\n        Credential credential = new BasicAuthCredential(username, password);\n\n        // Initialize CloudRecordingConfig\n        CloudRecordingConfig config = CloudRecordingConfig.builder()\n                .appId(appId)\n                .credential(credential)\n                // Specify the region where the server is located.\n                // Optional values are CN, US, EU, AP, and the client will automatically\n                // switch to use the best domain name according to the configured region\n                .domainArea(DomainArea.CN)\n                .build();\n\n        // Initialize CloudRecordingClient\n\n        CloudRecordingClient cloudRecordingClient = CloudRecordingClient.create(config);\n\n        AcquireResourceRes acquireResourceRes;\n\n        // Acquire resource\n        try {\n            acquireResourceRes = cloudRecordingClient\n                    .mixScenario()\n                    .acquire(cname, uid, AcquireMixRecordingResourceClientReq.builder()\n                            .build())\n                    .block();\n        } catch (AgoraException e) {\n            System.out.printf(\"agora error:%s\", e.getMessage());\n            return;\n        } catch (Exception e) {\n            System.out.printf(\"unknown error:%s\", e.getMessage());\n            return;\n        }\n\n        // Check if the response is null\n        if (acquireResourceRes == null || acquireResourceRes.getResourceId() == null) {\n            System.out.println(\"failed to get resource\");\n            return;\n        }\n\n        System.out.printf(\"resourceId:%s\", acquireResourceRes.getResourceId());\n\n        System.out.println(\"acquire resource success\");\n\n        // Define storage config\n        StartResourceReq.StorageConfig storageConfig = StartResourceReq.StorageConfig.builder()\n                .accessKey(accessKey)\n                .secretKey(secretKey)\n                .bucket(bucket)\n                .vendor(vendor)\n                .region(region)\n                .build();\n\n        // Define start resource request\n        StartMixRecordingResourceClientReq startResourceReq = StartMixRecordingResourceClientReq.builder()\n                .token(token)\n                .recordingConfig(StartResourceReq.RecordingConfig.builder()\n                        .channelType(1)\n                        .streamTypes(2)\n                        .maxIdleTime(30)\n                        .audioProfile(2)\n                        .transcodingConfig(StartResourceReq.TranscodingConfig.builder()\n                                .width(640)\n                                .height(480)\n                                .fps(15)\n                                .bitrate(800)\n                                .mixedVideoLayout(0)\n                                .backgroundColor(\"#000000\")\n                                .build())\n                        .subscribeAudioUIDs(Collections.singletonList(\"#allstream#\"))\n                        .subscribeVideoUIDs(Collections.singletonList(\"#allstream#\"))\n                        .build())\n                .recordingFileConfig(StartResourceReq.RecordingFileConfig.builder()\n                        .avFileType(Arrays.asList(\"hls\", \"mp4\"))\n                        .build())\n                .storageConfig(storageConfig)\n                .build();\n\n        StartResourceRes startResourceRes;\n\n        // Start resource\n        try {\n            startResourceRes = cloudRecordingClient\n                    .mixScenario()\n                    .start(cname, uid,\n                            acquireResourceRes.getResourceId(),\n                            startResourceReq)\n                    .block();\n\n        } catch (AgoraException e) {\n            System.out.printf(\"agora error:%s\", e.getMessage());\n            return;\n        } catch (Exception e) {\n            System.out.printf(\"unknown error:%s\", e.getMessage());\n            return;\n        }\n\n        // Check if the response is null\n        if (startResourceRes == null || startResourceRes.getSid() == null) {\n            System.out.println(\"failed to start resource\");\n            return;\n        }\n\n        System.out.printf(\"sid:%s\", startResourceRes.getSid());\n\n        System.out.println(\"start resource success\");\n\n        Thread.sleep(3000);\n\n        QueryMixHLSAndMP4RecordingResourceRes queryResourceRes;\n\n        // Query resource\n        try {\n            queryResourceRes = cloudRecordingClient\n                    .mixScenario()\n                    .queryHLSAndMP4(startResourceRes.getResourceId(), startResourceRes.getSid())\n                    .block();\n\n        } catch (AgoraException e) {\n            System.out.printf(\"agora error:%s\", e.getMessage());\n            return;\n        } catch (Exception e) {\n            System.out.printf(\"unknown error:%s\", e.getMessage());\n            return;\n        }\n\n        if (queryResourceRes == null || queryResourceRes.getServerResponse() == null) {\n            System.out.println(\"failed to query resource\");\n            return;\n        }\n\n        System.out.println(\"query resource success\");\n\n        Thread.sleep(3000);\n\n        StopResourceRes stopResourceRes;\n\n        // Stop resource\n        try {\n            stopResourceRes = cloudRecordingClient\n                    .mixScenario()\n                    .stop(cname, uid, startResourceRes.getResourceId(), startResourceRes.getSid(),\n                            true)\n                    .block();\n        } catch (AgoraException e) {\n            System.out.printf(\"agora error:%s\", e.getMessage());\n            return;\n        } catch (Exception e) {\n            System.out.printf(\"unknown error:%s\", e.getMessage());\n            return;\n        }\n\n        // Check if the response is null\n        if (stopResourceRes == null || stopResourceRes.getSid() == null) {\n            System.out.println(\"failed to stop resource\");\n        } else {\n            System.out.println(\"stop resource success\");\n        }\n\n    }\n}\n\n```\n\nFor more examples, see [Example](./examples).\n\n## Contribution\n\nThis project welcomes and accepts contributions. If you encounter any issues or have suggestions for improvements, please open an issue or submit a Pull Request.\n\n# SemVer Versioning\n\nThis project uses Semantic Versioning (SemVer) to manage versions. The format is MAJOR.MINOR.PATCH.\n\n-   MAJOR version indicates incompatible changes.\n-   MINOR version indicates backward-compatible new features or enhancements.\n-   PATCH version indicates backward-compatible bug fixes and maintenance.\n    For more details, please refer to the [Semantic Versioning](https://semver.org) specification.\n\n## References\n\n-   [Agora API Documentation](https://docs.agora.io/en/)\n\n## License\n\nThis project is licensed under the MIT License. For more details, please refer to the LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagoraio-community%2Fagora-rest-client-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagoraio-community%2Fagora-rest-client-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagoraio-community%2Fagora-rest-client-java/lists"}