Skip to content

Add PATCH method support to the api command#156

Merged
githubsaturn merged 1 commit intocaprover:masterfrom
ivnnv:add-patch-method
Feb 8, 2026
Merged

Add PATCH method support to the api command#156
githubsaturn merged 1 commit intocaprover:masterfrom
ivnnv:add-patch-method

Conversation

@ivnnv
Copy link
Contributor

@ivnnv ivnnv commented Feb 8, 2026

Problem

The CapRover server now supports PATCH for partial app definition updates (merged in caprover/caprover#2372), but the CLI's api command only allows GET and POST methods. This means users cannot use caprover api to make partial updates — they must use external tools like curl.

Solution

Add PATCH as a valid HTTP method for the caprover api command, so the CLI stays in sync with the server's capabilities.

Example usage

Scale an app without touching any other settings:

caprover api -n my-machine -t /user/apps/appDefinitions/update -m PATCH -d '{"appName": "my-app", "instanceCount": 1}'

Changes

  • src/utils/Constants.ts — add 'PATCH' to API_METHODS
  • src/api/HttpClient.ts — add patchReq() method and PATCH dispatch in fetchInternal()
  • src/api/ApiManager.ts — widen callApi() type signature to accept 'PATCH'

Backward compatibility

  • GET and POST behavior is completely unchanged
  • PATCH is only available when explicitly specified via --method PATCH

The CapRover server now supports PATCH for partial app definition
updates (caprover/caprover#2372), but the CLI only allows GET and POST.

This adds PATCH as a valid method for the `caprover api` command,
enabling safe partial updates like scaling without wiping other fields.

Changes:
- Constants.ts: add 'PATCH' to API_METHODS
- HttpClient.ts: add patchReq() and PATCH dispatch in fetchInternal()
- ApiManager.ts: widen callApi() type to accept 'PATCH'
@githubsaturn githubsaturn merged commit 16ca8d7 into caprover:master Feb 8, 2026
2 checks passed
@githubsaturn
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants