advancedideasmechanics/api-client
Composer 安装命令:
composer require advancedideasmechanics/api-client
包简介
API Service to work with DotKernel
README 文档
README
An API client primarily to work with DotKernel API. https://github.com/dotkernel/api
CURRENTLY UNSTABLE
Install
Install via composer
Composer
composer install advancedideasmechanics/apiclient
Call package
Initialize
$apiclient = new ApiClient(baseurl, clientId, clientSecret, grantType, scope, userName, userSecret, tokenLocation, tokenFilename, debug, additionalParams);
See if it works, if api call works it will create a tokenFilename in your chosen location. Create location path if not already in place.
Test
$apiclient->getAccessToken();
Send data to API
$apiclient->makeApiRequest($endpoint, $body, $method = "GET", $additionalHeaders = []);
Initialize Details
Below uses some DotKernel defaults. DO NOT use those values in production.
baseurl = http://localhost:8083
clientId = frontend # DotKernel default
clientSecret = frontend # DotKernel default
grantType = password
scope = api # DotKernel default (you can keep this)
userName = test@dotkernel.com # DotKernel default
userSecret = dotkernel # DotKernel default
tokenLocation = /var/www/data/ # keep outside web folder
tokenFilename = token.json # can be any file name you wish.
debug = false # optional will default to false, this for guzzle debugging to log files.
additionParms = [] # Optional Guzzle parameters.
Send / Retrieve to API
endpoint = /someapiendpoint # start from the root of the baseurl
body = [] # Array of information that will be sent to api as json_encoded() can be just [] if using GET
method = GET # defaults to GET but you can use any HTTP VERB you set if the endpoint accepts it.
additionalHeader = [] # Optional for Guzzle
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-02