Skip to main content

Application Service

Application Service API performs CRUD actions against application resources.

Service Definition

Package: application Service: ApplicationService The ApplicationService provides comprehensive management capabilities for Argo CD applications, including creation, updates, synchronization, rollback, and resource management.

RPC Methods

List

Returns list of applications. Request: ApplicationQuery
name
string
The application’s name
refresh
string
Forces application reconciliation if set to ‘hard’
projects
string[]
The project names to restrict returned list applications
resourceVersion
string
When specified with a watch call, shows changes that occur after that particular version of a resource
selector
string
The selector to restrict returned list to applications only with matched labels
repo
string
The repoURL to restrict returned list applications
appNamespace
string
The application’s namespace
Response: ApplicationList REST Endpoint: GET /api/v1/applications

Get

Returns an application by name. Request: ApplicationQuery
name
string
required
The application’s name
appNamespace
string
The application’s namespace
Response: Application REST Endpoint: GET /api/v1/applications/{name}

Create

Creates an application. Request: ApplicationCreateRequest
application
Application
required
The application to create
upsert
bool
Whether to create or update the application if it already exists
validate
bool
Whether to validate the application before creating
Response: Application REST Endpoint: POST /api/v1/applications

Update

Updates an application. Request: ApplicationUpdateRequest
application
Application
required
The application to update
validate
bool
Whether to validate the application before updating
project
string
The project name
Response: Application REST Endpoint: PUT /api/v1/applications/{application.metadata.name}

Delete

Deletes an application. Request: ApplicationDeleteRequest
name
string
required
The application’s name
cascade
bool
Whether to cascade delete resources
propagationPolicy
string
The deletion propagation policy (Foreground, Background, or Orphan)
appNamespace
string
The application’s namespace
project
string
The project name
Response: ApplicationResponse REST Endpoint: DELETE /api/v1/applications/{name}

Sync

Syncs an application to its target state. Request: ApplicationSyncRequest
name
string
required
The application’s name
revision
string
The revision to sync to
dryRun
bool
Whether to perform a dry run
prune
bool
Whether to prune resources
strategy
SyncStrategy
The sync strategy to use
resources
SyncOperationResource[]
The specific resources to sync
manifests
string[]
Additional manifests to sync
syncOptions
SyncOptions
Sync options
appNamespace
string
The application’s namespace
revisions
string[]
Revisions for multi-source applications
Response: Application REST Endpoint: POST /api/v1/applications/{name}/sync

Rollback

Rollbacks an application to a previous revision. Request: ApplicationRollbackRequest
name
string
required
The application’s name
id
int64
required
The history ID to rollback to
dryRun
bool
Whether to perform a dry run
prune
bool
Whether to prune resources
appNamespace
string
The application’s namespace
Response: Application REST Endpoint: POST /api/v1/applications/{name}/rollback

Watch

Returns stream of application change events. Request: ApplicationQuery Response: Stream of ApplicationWatchEvent REST Endpoint: GET /api/v1/stream/applications

GetManifests

Returns application manifests. Request: ApplicationManifestQuery
name
string
required
The application’s name
revision
string
The revision to get manifests for
appNamespace
string
The application’s namespace
noCache
bool
Whether to bypass the cache
Response: ManifestResponse REST Endpoint: GET /api/v1/applications/{name}/manifests

UpdateSpec

Updates an application spec. Request: ApplicationUpdateSpecRequest
name
string
required
The application’s name
spec
ApplicationSpec
required
The new application spec
validate
bool
Whether to validate the spec before updating
appNamespace
string
The application’s namespace
Response: ApplicationSpec REST Endpoint: PUT /api/v1/applications/{name}/spec

Patch

Patches an application. Request: ApplicationPatchRequest
name
string
required
The application’s name
patch
string
required
The patch to apply
patchType
string
required
The patch type (json, merge, or strategic)
appNamespace
string
The application’s namespace
Response: Application REST Endpoint: PATCH /api/v1/applications/{name}

ResourceTree

Returns resource tree for an application. Request: ResourcesQuery
applicationName
string
required
The application’s name
namespace
string
Filter by namespace
name
string
Filter by resource name
version
string
Filter by API version
group
string
Filter by API group
kind
string
Filter by resource kind
appNamespace
string
The application’s namespace
Response: ApplicationTree REST Endpoint: GET /api/v1/applications/{applicationName}/resource-tree

WatchResourceTree

Returns stream of application resource tree updates. Request: ResourcesQuery Response: Stream of ApplicationTree REST Endpoint: GET /api/v1/stream/applications/{applicationName}/resource-tree

GetResource

Returns a single application resource. Request: ApplicationResourceRequest
name
string
required
The application’s name
namespace
string
The resource’s namespace
resourceName
string
required
The resource’s name
version
string
required
The API version
group
string
The API group
kind
string
required
The resource kind
appNamespace
string
The application’s namespace
Response: ApplicationResourceResponse
manifest
string
The resource manifest in YAML or JSON format
REST Endpoint: GET /api/v1/applications/{name}/resource

PatchResource

Patches a single application resource. Request: ApplicationResourcePatchRequest
name
string
required
The application’s name
namespace
string
The resource’s namespace
resourceName
string
required
The resource’s name
version
string
required
The API version
group
string
The API group
kind
string
required
The resource kind
patch
string
required
The patch to apply
patchType
string
required
The patch type
Response: ApplicationResourceResponse REST Endpoint: POST /api/v1/applications/{name}/resource

DeleteResource

Deletes a single application resource. Request: ApplicationResourceDeleteRequest
name
string
required
The application’s name
namespace
string
The resource’s namespace
resourceName
string
required
The resource’s name
version
string
required
The API version
group
string
The API group
kind
string
required
The resource kind
force
bool
Whether to force delete
orphan
bool
Whether to orphan the resource
Response: ApplicationResponse REST Endpoint: DELETE /api/v1/applications/{name}/resource

PodLogs

Returns stream of log entries for the specified pod. Request: ApplicationPodLogsQuery
name
string
required
The application’s name
namespace
string
The pod’s namespace
podName
string
The pod’s name
container
string
The container name
sinceSeconds
int64
Logs since N seconds ago
tailLines
int64
Number of lines to tail
follow
bool
Whether to follow the log stream
filter
string
Filter pattern for logs
previous
bool
Whether to get logs from previous container instance
Response: Stream of LogEntry
content
string
The log content
timeStampStr
string
The timestamp of the log entry
podName
string
The pod name
last
bool
Whether this is the last log entry
REST Endpoint: GET /api/v1/applications/{name}/pods/{podName}/logs

TerminateOperation

Terminates the currently running operation. Request: OperationTerminateRequest
name
string
required
The application’s name
appNamespace
string
The application’s namespace
Response: OperationTerminateResponse REST Endpoint: DELETE /api/v1/applications/{name}/operation

ManagedResources

Returns list of managed resources. Request: ResourcesQuery Response: ManagedResourcesResponse
items
ResourceDiff[]
List of managed resources with their diff status
REST Endpoint: GET /api/v1/applications/{applicationName}/managed-resources

ListResourceEvents

Returns a list of event resources. Request: ApplicationResourceEventsQuery
name
string
required
The application’s name
resourceNamespace
string
The resource’s namespace
resourceName
string
The resource’s name
resourceUID
string
The resource’s UID
Response: EventList REST Endpoint: GET /api/v1/applications/{name}/events

ListResourceActions

Returns list of available resource actions. Request: ApplicationResourceRequest Response: ResourceActionsListResponse
actions
ResourceAction[]
List of available actions for the resource
REST Endpoint: GET /api/v1/applications/{name}/resource/actions

RunResourceActionV2

Runs a resource action with parameters. Request: ResourceActionRunRequestV2
name
string
required
The application’s name
namespace
string
The resource’s namespace
resourceName
string
required
The resource’s name
version
string
required
The API version
group
string
The API group
kind
string
required
The resource kind
action
string
required
The action name to run
resourceActionParameters
ResourceActionParameters[]
Parameters for the action
Response: ApplicationResponse REST Endpoint: POST /api/v1/applications/{name}/resource/actions/v2

GetApplicationSyncWindows

Returns sync windows of the application. Request: ApplicationSyncWindowsQuery
name
string
required
The application’s name
appNamespace
string
The application’s namespace
Response: ApplicationSyncWindowsResponse
activeWindows
ApplicationSyncWindow[]
Currently active sync windows
assignedWindows
ApplicationSyncWindow[]
All assigned sync windows
canSync
bool
Whether the application can sync now
REST Endpoint: GET /api/v1/applications/{name}/syncwindows

RevisionMetadata

Returns the metadata for a specific revision. Request: RevisionMetadataQuery
name
string
required
The application’s name
revision
string
required
The revision to get metadata for
appNamespace
string
The application’s namespace
Response: RevisionMetadata REST Endpoint: GET /api/v1/applications/{name}/revisions/{revision}/metadata
Returns the list of all application deep links. Request: ListAppLinksRequest
name
string
required
The application’s name
namespace
string
The application’s namespace
Response: LinksResponse
items
LinkInfo[]
List of deep links
REST Endpoint: GET /api/v1/applications/{name}/links

gRPC Example

import (
    "context"
    "google.golang.org/grpc"
    applicationpkg "github.com/argoproj/argo-cd/v3/pkg/apiclient/application"
)

// Create a gRPC connection
conn, err := grpc.Dial("argocd-server:443", grpc.WithInsecure())
if err != nil {
    log.Fatal(err)
}
defer conn.Close()

// Create application service client
client := applicationpkg.NewApplicationServiceClient(conn)

// List applications
apps, err := client.List(context.Background(), &applicationpkg.ApplicationQuery{
    Projects: []string{"default"},
})
if err != nil {
    log.Fatal(err)
}

// Get a specific application
app, err := client.Get(context.Background(), &applicationpkg.ApplicationQuery{
    Name: "my-app",
})
if err != nil {
    log.Fatal(err)
}

// Sync an application
syncReq := &applicationpkg.ApplicationSyncRequest{
    Name: "my-app",
    Prune: true,
}
app, err = client.Sync(context.Background(), syncReq)
if err != nil {
    log.Fatal(err)
}