# 开源项目推荐:Magento2 API + Golang

**URL:** https://forum.magentochina.org/t/%E5%BC%80%E6%BA%90%E9%A1%B9%E7%9B%AE%E6%8E%A8%E8%8D%90magento2-api-golang/889
**Category:** Magento 2.X
**Tags:** magento2
**Created:** [2021 年1 月 2 日 16:06 UTC](https://forum.magentochina.org/t/%E5%BC%80%E6%BA%90%E9%A1%B9%E7%9B%AE%E6%8E%A8%E8%8D%90magento2-api-golang/889 "2021-01-02T16:06:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### 作者： ![Shuai](https://forum.magentochina.org/user_avatar/forum.magentochina.org/shuai/32/3_2.png) [@Shuai](https://forum.magentochina.org/u/Shuai)
#### 发布日期： [2021 年1 月 2 日 16:06 UTC](https://forum.magentochina.org/t/%E5%BC%80%E6%BA%90%E9%A1%B9%E7%9B%AE%E6%8E%A8%E8%8D%90magento2-api-golang/889/1 "2021-01-02T16:06:42Z")

</div>

最近一直有研究Golang，之前介绍过一个Python调用Magento2 API的一个类库:

> [@使用Python操作Magento2 API](https://forum.magentochina.org/t/%E4%BD%BF%E7%94%A8python%E6%93%8D%E4%BD%9Cmagento2-api/509):
>
> 目前测试了几个Magento的python库，就下面这个好用一点: 不过这个库也是只支持默认的操作方法，更多操作需要自己开发。不过目前来看已经够用了. 使用这个Python操作Magento2的API非常方便，看看这个github上的演示吧: 查找产品 所有 response = client.search\_product({'searchCriteria': ''}) github上写的这个方法实际是用问题的，正确的，查找所有产品的方法应该是: response = client.search\_product({'searchCriteria': '[]'}) 按创建时间，返回一条数据 response = client.search\_product({'searchCriteria[sortOrders][0][field]': 'created\_at', 'searchCriteria[pageSize]': '1'}) Magento API 创建产品 data = { "product": { "name": 'Perfume A…

最近发现一个Golang的也不错，这里给大家介绍一下:

> **[GitHub - Hermsi1337/go-magento2: A Golang package for communicating with the...](https://github.com/Hermsi1337/go-magento2)**
>
> A Golang package for communicating with the magento2 api - GitHub - Hermsi1337/go-magento2: A Golang package for communicating with the magento2 api

上面两个库，熟悉什么就用什么嘛。Magento2 API还是比Magento1丰富多了，跨应用调用数据的时候也确实方便不少。
