johanwinther/chalmers-card-balance
Composer 安装命令:
composer create-project johanwinther/chalmers-card-balance
包简介
Public REST API for checking account balance of Chalmers Student Union cards
README 文档
README
chalmers-card-balance
Public REST API for checking account balance of Chalmers Student Union cards
Installation
Add johanwinther/chalmers-card-balance as a require dependency in your composer.json file:
composer require johanwinther/chalmers-card-balance
Rename .htaccess.tmp to .htaccess and set the RewriteBase to the absolute folder path of card.php.
API
Show Card Balance
Returns JSON data of card balance.
-
URL
/<Card number> -
Method:
GET -
URL Params
Required:
Card number- 16-digit Student Union card number -
Data Params
None
-
Success Response:
- Code: 200
Content:{ "cardHolder": "Emil Emilsson", "cardNumber": "1111222233334444", "cardBalance": { "value": 200.01, "currency": "kr" } }
- Code: 200
-
Error Response:
- Code: 400 BAD REQUEST
Content:{ "error": "Invalid card number: should be 16 digits." }Explanation: Request was not 16 digits.
OR
- Code: 404 NOT FOUND
Content:{ "error": "Invalid card number: card not found." }Explanation: Card is not registered in the system.
OR
- Code: 408 REQUEST TIMED OUT
Content:{ "error": "Connection timed out." }Explanation: Could not load external service.
- Code: 400 BAD REQUEST
-
Sample Call:
$.ajax({ url: "https://ftek.se/api/v1/1111222233334444", dataType: "json", type : "GET", success : function(r) { console.log(r); } });
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-26