Shopware 6 Admin API 的文档。什么是可能的命令?
Documentation for Shopware 6 Admin API. What are possible commands?
我接到了将我们老店的系统集成到 Shopware 6 的任务。所以我必须与管理员打交道 API。文档说:
The Admin API is designed in such a way that all entities of the
system can be read in the same way. Once an entity is registered in
the system, it can be written and read via API
https://developer.shopware.com/docs/guides/integrations-api/admin-api/reading-entities
这些实体是如何运作的?是否有所有默认实体的list/documentation?我必须自己注册实体吗?
您不需要注册 Shopware 核心提供的“默认”实体。但是,如果您定义自己的自定义实体,则必须将其注册为服务。您可以使用生成 swagger UI 文档的 /api/v{version}/_info/swagger.html 端点获取在核心中注册的实体列表。
Shopware 6 API 文档来源
public Shopware 6 API 文档(管理 API 和商店 API)可在
- 对于 Shopware >= 6.4:https://shopware.stoplight.io/
- 所有版本:https://swagger.docs.fos.gg/
本地文档
否则,您可以使用 Valerii 指出的 /api/v{version}/_info/swagger.html
。
请注意,从 Shopware 6.4 开始,请求中不再使用 API 版本。所以 as per documentation 你必须打开像
这样的东西
https://your-shop-url.invalid/api/_info/swagger.html
确保您已设置
APP_ENV=dev
在您的 .env
中并且仅在本地使用它,而不是在 public 只能访问的服务器上使用。
使用本地文档的好处是,您还将看到由其他扩展引入的端点。
逆向工程而不是文档
此外,在 Shopware 管理面板中执行预期操作时,您始终可以检查浏览器的网络选项卡,并了解必要的请求。
我接到了将我们老店的系统集成到 Shopware 6 的任务。所以我必须与管理员打交道 API。文档说:
The Admin API is designed in such a way that all entities of the system can be read in the same way. Once an entity is registered in the system, it can be written and read via API
https://developer.shopware.com/docs/guides/integrations-api/admin-api/reading-entities
这些实体是如何运作的?是否有所有默认实体的list/documentation?我必须自己注册实体吗?
您不需要注册 Shopware 核心提供的“默认”实体。但是,如果您定义自己的自定义实体,则必须将其注册为服务。您可以使用生成 swagger UI 文档的 /api/v{version}/_info/swagger.html 端点获取在核心中注册的实体列表。
Shopware 6 API 文档来源
public Shopware 6 API 文档(管理 API 和商店 API)可在
- 对于 Shopware >= 6.4:https://shopware.stoplight.io/
- 所有版本:https://swagger.docs.fos.gg/
本地文档
否则,您可以使用 Valerii 指出的 /api/v{version}/_info/swagger.html
。
请注意,从 Shopware 6.4 开始,请求中不再使用 API 版本。所以 as per documentation 你必须打开像
这样的东西 https://your-shop-url.invalid/api/_info/swagger.html
确保您已设置
APP_ENV=dev
在您的 .env
中并且仅在本地使用它,而不是在 public 只能访问的服务器上使用。
使用本地文档的好处是,您还将看到由其他扩展引入的端点。
逆向工程而不是文档
此外,在 Shopware 管理面板中执行预期操作时,您始终可以检查浏览器的网络选项卡,并了解必要的请求。