hscore/hsapi
Composer 安装命令:
composer require hscore/hsapi
包简介
REST api for B2B partners of Hifi Station Kft.
README 文档
README
In Hifi Station Kft we decided to create a new automation system for our B2B partners. You can connect your webshop, ecommerce, or any other system to our API.
We won't be able to write your backend code but we will help you to create the connection.
The api does not support OpenCart/Magento/PrestaShop/WooCommerce/Unas/Shoprenter/etc. You need to write your own code to connect to your system.
Requirements
- PHP 7.4
- Composer
- ext-openssl: *
- ext-simlexml: *
- ext-json: *
Features
- List products with informations
- Secure authentication (HTTP Basic Auth + API Key)
- JSON/XML REST output
Installation
"hscore/hsapi": "*"
or run
composer require hscore/hsapi
Note that the vendor folder and the vendor/autoload.php script are generated by Composer; they are not part of the api.
Alternatively, if you're not using Composer, you can download HSApi as a zip file, then copy the contents of the HSApi folder into one of the include_path directories specified in your PHP configuration and load class file manually:
use hscore\RequestGenerator; require 'path/to/src/RequestGenerator.php'; /* or wherever the file is located */
Authentication
In order to use the API you need to authenticate. You can do this by using the authenticate method.
We prepared a simlified authentication method.
You can use the authentication credentails in the following way:
https://api.hifi-station.hu/v2/products?username=USERNAME&password=PASSWORD&api_key=API_KEY
In the email that we send you after a successful registration copy the data and change the UPPERCASE strings.
You can change the output (JSON or XML) by adding the extension to "products".
https://api.hifi-station.hu/v2/products.xml or json
$request->authenticate('api_username', 'api_password', 'api_key');
Output format
We provide two output formats: JSON and XML.
To change the output format, use the setOutputFormat method.
$request->setOutputFormat('json'); // or 'xml', default is 'json'
Use this method before the send() method.
Usage
$request = new RequestGenerator('products'); $request->authenticate('api_username', 'api_password', 'api_key'); $response = $request->send(); echo $response;
Other informations
Note, that the API is not stable yet.
In the result the stock tag is not always correct. If we have more than 10 product in stock the value always will be 10.
Functions
send() return the response in the format you specified.
authenticate(string $username, string $password, string $api_key) authenticate the request.
setOutputFormat(string $type) set the output format.
public $disablePrettyHeader = false; disable the php header() function.
Security
Please submit bug reports, or you found a mistake in the docs, or want to add something suggestions create a pull request or go ahead and create an issue at Github issue tracker
Disclaimer
This is an open source project. We are not responsible for any damage caused by this software. If you want to update the prices of the product automatically, please note that it may differ from the price you offer.
hscore/hsapi 适用场景与选型建议
hscore/hsapi 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 06 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 hscore/hsapi 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hscore/hsapi 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-27