4

I need to list all applications based on some label filters.

https://argocd_domain/api/v1/applications

in order to list all apps from argoCD API, I want to put all possible filters.

crenshaw-dev
  • 7,504
  • 3
  • 45
  • 81
Abhishek kumar
  • 129
  • 1
  • 8

3 Answers3

7

The Argo CD API is documented in its Swagger document.

Copy and paste that JSON to the Swagger Editor, and you'll get a nicely-formatted page describing the API. Here's the section for listing applications:

Screenshot of Swagger Editor section for listing applications

The function to handle a list-applications request calls ConvertSelectorToLabelsMap. Reading the implementation of that parsing function, you can find the expected format of the selector parameter.

At a glance, it seems the format is a comma-delimited list of key=value pairs.

Using the Swagger Editor, I generated the this test URL:

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

Looks like you'll need to URL-encode the equals signs and commas.

crenshaw-dev
  • 7,504
  • 3
  • 45
  • 81
5

You can find the Swagger docs by setting the path to /swagger-ui in your Argo CD server address. E.g. http://localhost:8080/swagger-ui.

bayman
  • 1,579
  • 5
  • 23
  • 46
3

You can find a hosted version of Argo's Swagger UI on https://cd.apps.argoproj.io/swagger-ui

ArgoCD Swagger UI

Timofey Drozhzhin
  • 4,416
  • 3
  • 28
  • 31