{"id":20732430,"url":"https://github.com/jpush/jmessage-api-java-client","last_synced_at":"2025-04-23T22:20:30.950Z","repository":{"id":32406320,"uuid":"35983114","full_name":"jpush/jmessage-api-java-client","owner":"jpush","description":"JiGuang's officially supported Java client library for accessing JMessage APIs. 极光官方支持的 Java 版本服务器端 SDK。","archived":false,"fork":false,"pushed_at":"2022-05-20T20:47:11.000Z","size":1462,"stargazers_count":60,"open_issues_count":5,"forks_count":29,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-30T04:05:25.558Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.jiguang.cn","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/jpush.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}},"created_at":"2015-05-21T01:15:30.000Z","updated_at":"2024-11-26T08:52:22.000Z","dependencies_parsed_at":"2022-08-24T13:21:16.610Z","dependency_job_id":null,"html_url":"https://github.com/jpush/jmessage-api-java-client","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpush%2Fjmessage-api-java-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpush%2Fjmessage-api-java-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpush%2Fjmessage-api-java-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpush%2Fjmessage-api-java-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpush","download_url":"https://codeload.github.com/jpush/jmessage-api-java-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250522819,"owners_count":21444607,"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","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":[],"created_at":"2024-11-17T05:19:22.769Z","updated_at":"2025-04-23T22:20:30.933Z","avatar_url":"https://github.com/jpush.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitHub version](https://badge.fury.io/gh/jpush%2Fjmessage-api-java-client.svg)](https://badge.fury.io/gh/jpush%2Fjmessage-api-java-client) \n\n# JMessage API Java Library\n\n## 概述\n\n这是 JMessage REST API 的 Java 版本封装开发包，是由极光推送官方提供的，一般支持最新的 API 功能。\n\n对应的 REST API 文档：\u003chttps://docs.jiguang.cn/jmessage/server/rest_api_im/\u003e\n\n版本更新：[Release页面](https://github.com/jpush/jmessage-api-java-client/releases)。下载更新请到这里。\n\n\u003e 非常欢迎各位开发者提交代码，贡献一份力量，review过有效的代码将会合入本项目。\n\n\n## 安装\n\n### maven 方式\n将下边的依赖条件放到你项目的 maven pom.xml 文件里。\n\u003e 其中 slf4j 可以与 logback, log4j, commons-logging 等日志框架一起工作，可根据你的需要配置使用。\n\n```Java\n\u003cdependency\u003e\n    \u003cgroupId\u003ecn.jpush.api\u003c/groupId\u003e\n    \u003cartifactId\u003ejmessage-client\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.9\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003ecn.jpush.api\u003c/groupId\u003e\n    \u003cartifactId\u003ejiguang-common\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.3\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n\t\u003cgroupId\u003ecom.google.code.gson\u003c/groupId\u003e\n\t\u003cartifactId\u003egson\u003c/artifactId\u003e\n\t\u003cversion\u003e2.3\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n\t\u003cgroupId\u003eorg.slf4j\u003c/groupId\u003e\n\t\u003cartifactId\u003eslf4j-api\u003c/artifactId\u003e\n\t\u003cversion\u003e1.7.7\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003c!-- For log4j --\u003e\n\u003cdependency\u003e\n\t\u003cgroupId\u003eorg.slf4j\u003c/groupId\u003e\n\t\u003cartifactId\u003eslf4j-log4j12\u003c/artifactId\u003e\n\t\u003cversion\u003e1.7.7\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n\t\u003cgroupId\u003elog4j\u003c/groupId\u003e\n\t\u003cartifactId\u003elog4j\u003c/artifactId\u003e\n\t\u003cversion\u003e1.2.17\u003c/version\u003e\n\u003c/dependency\u003e\n```\n### jar 包方式\n\n请到 [Release页面](https://github.com/jpush/jmessage-api-java-client/releases)下载相应版本的发布包。\n\n### 依赖包\n* [slf4j](http://www.slf4j.org/) / log4j (Logger)\n* [gson](https://code.google.com/p/google-gson/) (Google JSON Utils)\n* [jiguang-common](https://github.com/jpush/jiguang-java-client-common)\n\n\u003e 其中 slf4j 可以与 logback, log4j, commons-logging 等日志框架一起工作，可根据你的需要配置使用。\n\n\u003e jiguang-common 的 jar 包下载。[请点击](https://github.com/jpush/jmessage-api-java-client/releases)\n\n## 编译源码\n\n\u003e 如果开发者想基于本项目做一些扩展的开发，或者想了解本项目源码，可以参考此章，否则可略过此章。\n\n### 导入本项目\n\n* 可以采用 `git clone https://github.com/jpush/jmessage-api-java-client.git jmessage-api-src` 命令下载源码\n* 如果不使用git，请到[Release页面](https://github.com/jpush/jmessage-api-java-client/releases)下载源码包并解压\n* 采用eclipse导入下载的源码工程，推荐采用maven的方式，方便依赖包的管理\n* 假如采用导入普通项目的方式，项目报错，检查Build Path，Libraries\n * 依赖jar包都在libs目录下可以找到，没有加入的请添加到Build Path，Libraries\n * jpush-client jar包可以[点击下载](https://github.com/jpush/jpush-api-java-client/releases)\n * 默认采用了log4j做日志框架，开发者可根据自己需求替换logback、commons-logging等日志框架\n * 极个别情况下，如果test目录报错，请手动添加test的依赖jar包mockwebserver-2.0.0.jar、okhttp-2.0.0.jar、okio-1.0.0.jar\n* 开发者需要注意，将本项目的编码格式设置为UTF-8\n\n### 构建本项目\n\n可以用 Eclipse 类 IDE 导出 jar 包。建议直接使用 maven，执行命令：\n\n\tmaven package\n\n### 自动化测试\n\n在项目目录下执行命令：\n\n\tmvn test\n\n## 使用样例\n\n\u003e 以下片断来自项目代码里的文件：example / cn.jmessage.api.examples.UserExample\n\n```Java\n\tpublic static void testGetUserInfo() {\n        JMessageClient client = new JMessageClient(appkey, masterSecret);\n        try {\n            String res = client.getUserInfo(\"test_user\");\n            LOG.info(res);\n        } catch (APIConnectionException e) {\n            LOG.error(\"Connection error. Should retry later. \", e);\n        } catch (APIRequestException e) {\n            LOG.error(\"Error response from JPush server. Should review and fix it. \", e);\n            LOG.info(\"HTTP Status: \" + e.getStatus());\n            LOG.info(\"Error Message: \" + e.getMessage());\n        }\n    }\n```\n\n\u003e 以下片断来自项目代码里的文件：example / cn.jmessage.api.examples.GroupExample\n```Java\n\tpublic static void testCreateGroup() {\n        JMessageClient client = new JMessageClient(appkey, masterSecret);\n        try {\n            String res = client.createGroup(\"test_user\", \"test_gname1\", \"description\", \"test_user\");\n            LOG.info(res);\n        } catch (APIConnectionException e) {\n            LOG.error(\"Connection error. Should retry later. \", e);\n        } catch (APIRequestException e) {\n            LOG.error(\"Error response from JPush server. Should review and fix it. \", e);\n            LOG.info(\"HTTP Status: \" + e.getStatus());\n            LOG.info(\"Error Message: \" + e.getMessage());\n        }\n    }\n```\n\n## 贡献者列表\n\n* [@tangyikai](https://github.com/tangyikai)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpush%2Fjmessage-api-java-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpush%2Fjmessage-api-java-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpush%2Fjmessage-api-java-client/lists"}