# android-api **Repository Path**: sunxyz/android-api ## Basic Information - **Project Name**: android-api - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-10-09 - **Last Updated**: 2020-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # android-api > 基于线上系统对接安卓接口 > 以下接口基于41 开发环境 token可用时长30天 ## 1.获取token > 采用密码模式 ``` POST /oauth/token HTTP/1.1 Host: 192.168.2.41:8090 Authorization: Basic YW5kcm9pZDphbmRyb2lkLXNlY3JldA== Content-Type: application/x-www-form-urlencoded grant_type=password&username=admin&password=123456 ``` **返回** ``` HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Cache-Control: no-store Pragma: no-cache { "access_token": "90cbefb9-ad98-4d7f-a0bf-33b76f369a42", "token_type": "bearer", "refresh_token": "d5227c6a-40d0-4bf6-ac22-9cb726f2da1f", "expires_in": 2536496, "scope": "ALL" } ``` ## 2.注销 ``` DELETE /oauth/token?access_token=90cbefb9-ad98-4d7f-a0bf-33b76f369a42 HTTP/1.1 Host: 192.168.2.41:8090 Authorization: Basic YW5kcm9pZDphbmRyb2lkLXNlY3JldA== ``` **返回** ``` HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Cache-Control: no-store Pragma: no-cache 注销成功 ``` ## 3.调用接口 ``` GET /test/brands HTTP/1.1 Host: localhost:8080 Authorization: bearer 90cbefb9-ad98-4d7f-a0bf-33b76f369a42 ``` **返回** ``` HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Cache-Control: no-store Pragma: no-cache [ { "id": 2, "name": "华为", "sort": null }, { "id": 3, "name": "荣耀", "sort": null }, { "id": 1, "name": "小米", "sort": 1 } ] ``` ## 4.相关微服务 ![相关微服务](./20180804114945.png) ## 5.安卓版本更新 **两种方式** 首先上传oss 更新版本信息 1 通过 阿里云修改 如 > ANDROID_VERSION_CODE = 1 2 通过接口推送 ``` PUT version HTTP/1.1 Host: android-api.jinyijia1688.com Content-Type: application/json;charset=UTF-8 { "versionCode": 4, "version": "1.0.3", "downloadUrl": "http://dd-3j1688-com.oss-cn-beijing.aliyuncs.com/jinyijia-V1.0.3-20180912.apk" } ```