在哪里可以获得ArgoCD API的深入文档

问题描述

我需要基于一些标签过滤器列出所有应用程序。

https:// argocd_domain / api / v1 /应用程序

为了列出argoCD API中的所有应用程序,我想放置所有可能的过滤器。

解决方法

Argo CD API记录在其Swagger document中。

将该JSON复制并粘贴到Swagger Editor,您将获得一个格式正确的页面,描述API。这是列出应用程序的部分:

Screenshot of Swagger Editor section for listing applications

function to handle a list-applications request调用ConvertSelectorToLabelsMap。阅读the implementation of that parsing function,您可以找到selector参数的预期格式。

乍一看,该格式似乎是key=value对的逗号分隔列表。

使用Swagger编辑器,我生成了以下测试URL:

curl -X GET "https://editor.swagger.io/api/v1/applications?selector=label1%3Dvalue1%2Clabel2%3Dvalue2" -H  "accept: application/json"

您似乎需要对等号和逗号进行网址编码。