astroselling / jupiter-sdk
Astroselling 集成 SDK
Requires
- katzgrau/klogger: dev-master
README
PHP 包,用于让 ERP 系统集成到 Astroselling 在线商店管理平台 - https://astroselling.com/
安装方法
- composer require astroselling/jupiter-sdk
在 Astroselling 页面中的“我的账户”模块 - https://nova.astroselling.com/admin/account- 用户可以生成自己的 API 密钥来访问这些服务。
如有任何问题,支持团队随时待命: soporte@astroselling.com
如果需要直接使用其他语言进行集成,以下是 API 文档
Astroselling Jupiter - API
以下将展示一组端点,用于将产品集成到 Astroselling。特别是,将详细说明如何创建、更新和删除产品,获取与用户及其产品相关的渠道,以及查看平台状态。
在 Astroselling 页面中的“我的账户”模块 - https://nova.astroselling.com/admin/account- 用户可以生成自己的 API 密钥来访问这些服务。
如有任何问题,支持团队随时待命: soporte@astroselling.com
目录
身份验证
要使用端点,需要使用 Astroselling 用户进行身份验证。可以从 https://nova.astroselling.com 获取令牌,使用相应用户登录并进入“我的账户”部分。从那里还可以生成新的令牌,立即使旧令牌无效。
有两种方式发送 TOKEN 进行身份验证
查询字符串身份验证
**注意:此方法不安全,因为令牌会通过 URL 发送。
在请求 URL 中添加查询字符串 &api_token={{api_token}}
示例: https://nova.astroselling.com/jupiter/v1/channels?api_token={{api_token}}
Bearer 令牌身份验证
添加名为 "Authentication" 的头,并设置值为 "Bearer {{api_token}}"。示例
CURL 示例
curl --location --request GET 'https://nova.astroselling.com/jupiter/v1/channels' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
使用 Guzzle PHP 客户端示例
$response = $client->request('POST', '/api/user', [
'headers' => [
'Authorization' => 'Bearer '.$token,
'Accept' => 'application/json',
],
]);
1. 创建产品
此端点用于在 Astroselling 中注册产品。在 POST 请求体中应发送产品的全部信息。
- 这些信息也可以是变体。
端点
Method: POST Type: RAW URL: http://nova.astroselling.com/jupiter/v1/jupiter/v1/channels/{{CHANNEL_ID}}/products
头部
主体
{ "id_in_erp": "10200240", "sku": "10200240", "title": "Pantalon J\u00fanior", "description": "Pantalon J\u00c3\u00banior", "currency": "USD", "price": 790, "stock": 120, "variations": [ { "id_in_erp": "10200240 001 06", "stock": 1, "price": 790, "sku": "10200240 001 06", "title": "Pantalon J\u00fanior", "attributes": [ { "id": "attr_id_1", "name": "Color", "value": "Verde" }, { "id": "attr_id_1", "name": "Talle", "value": "M" } ], "images": [ { "path": "http://via.placeholder.com/300/09f/fff.png?text=a" }, { "path": "http://via.placeholder.com/300/09f/fff.png?text=b" }, { "path": "http://via.placeholder.com/300/09f/fff.png?text=c" } ] }, { "id_in_erp": "10200240 002 06", "stock": 0, "price": 790, "sku": "10200240 002 06", "title": "Pantalon J\u00fanior", "attributes": [ { "id": "attr_id_1", "name": "Color", "value": "Verde" }, { "id": "attr_id_1", "name": "Talle", "value": "M" } ], "images": [ { "path": "http://via.placeholder.com/300/09f/fff.png?text=1" }, { "path": "http://via.placeholder.com/300/09f/fff.png?text=2" }, { "path": "http://via.placeholder.com/300/09f/fff.png?text=3" } ] } ], "images": [ { "path": "https://contents.mediadecathlon.com/p1484240/ab565f3675dbdd7e3c486175e2c16583/p1484240.jpg" }, { "path": "https://contents.mediadecathlon.com/p1484210/8ae4fe12797325bc4b98b6af45bc208b/p1484210.jpg" } ] }
2. 删除产品
此端点用于从渠道中删除产品。
端点
Method: DELETE Type: RAW URL: http://nova.astroselling.com/jupiter/v1/jupiter/v1/channels/{{CHANNEL_ID}}/products/{{ID_IN_ERP}}
头部
3. 获取渠道产品
此端点返回特定渠道的所有相关文章。特别是,我们将查看以下数据
- channel_id
- id_in_erp
- sku
- title
- price
- currency
- stock
- description
- extra_info
- variations
- images
端点
Method: GET Type: URL: http://nova.astroselling.com/jupiter/v1/jupiter/v1/channels/{{CHANNEL_ID}}/products
头部
查询参数
4. 获取渠道产品信息
返回特定渠道和产品的信息。具体返回以下属性
- channel_id
- id_in_erp
- sku
- title
- price
- currency
- stock
- description
- extra_info
- variations
- images
端点
Method: GET Type: URL: http://nova.astroselling.com/jupiter/v1/jupiter/v1/channels/{{CHANNEL_ID}}/products/{{ID_IN_ERP}}
头部
5. 获取渠道
提供用户拥有的渠道(及其对应的标识符)的列表。通过响应的ID可以执行后续端点。特别是,返回渠道的ID、内部名称、同步方法(通常是“推送”)和渠道类型。
端点
Method: GET Type: URL: http://nova.astroselling.com/jupiter/v1/jupiter/v1/channels
头部
6. 健康检查
该端点允许获取平台的当前状态。
- 如果API运行正常,则返回HTTP状态码200。
端点
Method: GET Type: URL: http://nova.astroselling.com/jupiter/v1/jupiter/v1/healthcheck
头部
7. 更新产品
此端点用于更新渠道中某篇文章的信息。只需传递要更新的属性。执行PUT操作后,将返回Astroselling更新后的产品所有信息。
- 属性“图像”必须是一个数组。
端点
Method: PUT Type: RAW URL: http://nova.astroselling.com/jupiter/v1/jupiter/v1/channels/{{CHANNEL_ID}}/products/{{ID_IN_ERP}}
头部
主体
{ "price": 103, "stock": 8, "images": [ "https://contents.mediadecathlon.com/p1484240/ab565f3675dbdd7e3c486175e2c16583/p1484240.jpg" ] }
可用变量