shacky/php-allegro-rest-api
最新稳定版本:0.0.7
Composer 安装命令:
composer require shacky/php-allegro-rest-api
包简介
simple interface for Allegro REST API
README 文档
README
Simple interface for Allegro REST API resources
Authorization and Tokens
In order to use Allegro REST Api, you have to register your application and authorize it (https://developer.api.allegro.pl/auth/).
Authorization link
$api = new Api($clientId, $clientSecret, $redirectUri, null, null); echo $api->getAuthorizationUri();
Getting new token
# example contents of your_redirect_uri.com/index.php $code = $_GET['code']; $api = new Api($clientId, $clientSecret, $redirectUri, null, null); $response = $api->getNewAccessToken($code); # response contains json with your access_token and refresh_token
Refreshing existing token
$api = new Api($clientId, $clientSecret, $redirectUri, $accessToken, $refreshToken); $response = $api->refreshAccessToken(); # response contains json with your new access_token and refresh_token
Example usage
$api = new Api($clientId, $clientSecret, $redirectUri, $accessToken, $refreshToken); // GET https://api.allegro.pl/{resource} // $api->{resource}->get(); // GET https://api.allegro.pl/categories $api->categories->get(); // GET https://api.allegro.pl/{resource}/{resource_id} // $api->{resource}({resource_id})->get(); // GET https://api.allegro.pl/categories/2 $api->categories(2)->get(); // PUT https://api.allegro.pl/{resource}/{resource_id}/{command-name}-command/{uuid} // $api->{resource}({resource_id})->commands()->{command_name}($data); // PUT https://api.allegro.pl/offers/12345/change-price-commands/84c16171-233a-42de-8115-1f1235c8bc0f $api->offers(12345)->commands()->change_price($data); // POST https://upload.allegro.pl/sale/images $api->sale->images->upload($data); // GET https://api.allegro.pl/sale/products beta v1 method $api->sale->products->get($data,1,true);
统计信息
- 总下载量: 166
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-22