Skip to content
Start here

Update an App

client.MagicTransit.Apps.Edit(ctx, accountAppID, params) (*AppEditResponse, error)
PATCH/accounts/{account_id}/magic/apps/{account_app_id}

Updates an Account App

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
ParametersExpand Collapse
accountAppID string

Identifier

maxLength32
params AppEditParams
AccountID param.Field[string]

Path param: Identifier

maxLength32
Hostnames param.Field[[]string]optional

Body param: FQDNs to associate with traffic decisions.

IPSubnets param.Field[[]string]optional

Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported)

Name param.Field[string]optional

Body param: Display name for the app.

SourceSubnets param.Field[[]string]optional

Body param: IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported)

Type param.Field[string]optional

Body param: Category of the app.

ReturnsExpand Collapse
type AppEditResponse struct{…}

Custom app defined for an account.

AccountAppID string

Magic account app ID.

Hostnames []stringoptional

FQDNs to associate with traffic decisions.

IPSubnets []stringoptional

IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported)

Name stringoptional

Display name for the app.

SourceSubnets []stringoptional

IPv4 CIDRs to associate with traffic decisions. (IPv6 CIDRs are currently unsupported)

Type stringoptional

Category of the app.

Update an App

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/magic_transit"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.MagicTransit.Apps.Edit(
    context.TODO(),
    "023e105f4ecef8ad9ca31a8372d0c353",
    magic_transit.AppEditParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.AccountAppID)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "account_app_id": "ac60d3d0435248289d446cedd870bcf4",
    "hostnames": [
      "auth.cloudflare.com"
    ],
    "ip_subnets": [
      "192.0.2.0/24"
    ],
    "name": "Cloudflare Dashboard",
    "source_subnets": [
      "192.0.2.0/24"
    ],
    "type": "Development"
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "account_app_id": "ac60d3d0435248289d446cedd870bcf4",
    "hostnames": [
      "auth.cloudflare.com"
    ],
    "ip_subnets": [
      "192.0.2.0/24"
    ],
    "name": "Cloudflare Dashboard",
    "source_subnets": [
      "192.0.2.0/24"
    ],
    "type": "Development"
  },
  "success": true
}