Skip to content
Start here

Retrieve discovered operations on a zone

client.APIGateway.Discovery.Operations.List(ctx, params) (*V4PagePaginationArray[DiscoveryOperation], error)
GET/zones/{zone_id}/api_gateway/discovery/operations

Retrieve the most up to date view of discovered operations

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
Accepted Permissions (at least one required)
Account API GatewayAccount API Gateway ReadDomain API GatewayDomain API Gateway Read
ParametersExpand Collapse
params DiscoveryOperationListParams
ZoneID param.Field[string]

Path param: Identifier.

maxLength32
Diff param.Field[bool]Optional

Query param: When true, only return API Discovery results that are not saved into API Shield Endpoint Management

Direction param.Field[DiscoveryOperationListParamsDirection]Optional

Query param: Direction to order results.

const DiscoveryOperationListParamsDirectionAsc DiscoveryOperationListParamsDirection = "asc"
const DiscoveryOperationListParamsDirectionDesc DiscoveryOperationListParamsDirection = "desc"
Endpoint param.Field[string]Optional

Query param: Filter results to only include endpoints containing this pattern.

Host param.Field[[]string]Optional

Query param: Filter results to only include the specified hosts.

Method param.Field[[]string]Optional

Query param: Filter results to only include the specified HTTP methods.

Order param.Field[DiscoveryOperationListParamsOrder]Optional

Query param: Field to order by

const DiscoveryOperationListParamsOrderHost DiscoveryOperationListParamsOrder = "host"
const DiscoveryOperationListParamsOrderMethod DiscoveryOperationListParamsOrder = "method"
const DiscoveryOperationListParamsOrderEndpoint DiscoveryOperationListParamsOrder = "endpoint"
const DiscoveryOperationListParamsOrderTrafficStatsRequests DiscoveryOperationListParamsOrder = "traffic_stats.requests"
const DiscoveryOperationListParamsOrderTrafficStatsLastUpdated DiscoveryOperationListParamsOrder = "traffic_stats.last_updated"
Origin param.Field[DiscoveryOperationListParamsOrigin]Optional

Query param: Filter results to only include discovery results sourced from a particular discovery engine

  • ML - Discovered operations that were sourced using ML API Discovery
  • SessionIdentifier - Discovered operations that were sourced using Session Identifier API Discovery
const DiscoveryOperationListParamsOriginMl DiscoveryOperationListParamsOrigin = "ML"
const DiscoveryOperationListParamsOriginSessionIdentifier DiscoveryOperationListParamsOrigin = "SessionIdentifier"
const DiscoveryOperationListParamsOriginLabelDiscovery DiscoveryOperationListParamsOrigin = "LabelDiscovery"
Page param.Field[int64]Optional

Query param: Page number of paginated results.

minimum1
PerPage param.Field[int64]Optional

Query param: Maximum number of results per page.

maximum50
minimum5
State param.Field[DiscoveryOperationListParamsState]Optional

Query param: Filter results to only include discovery results in a particular state. States are as follows

  • review - Discovered operations that are not saved into API Shield Endpoint Management
  • saved - Discovered operations that are already saved into API Shield Endpoint Management
  • ignored - Discovered operations that have been marked as ignored
const DiscoveryOperationListParamsStateReview DiscoveryOperationListParamsState = "review"
const DiscoveryOperationListParamsStateSaved DiscoveryOperationListParamsState = "saved"
const DiscoveryOperationListParamsStateIgnored DiscoveryOperationListParamsState = "ignored"
ReturnsExpand Collapse
type DiscoveryOperation struct{…}
ID string

UUID.

maxLength36
minLength36
Endpoint string

The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/.

formaturi-template
maxLength4096
Host string

RFC3986-compliant host.

formathostname
maxLength255
LastUpdated Time
formatdate-time
Method DiscoveryOperationMethod

The HTTP method used to access the endpoint.

One of the following:
const DiscoveryOperationMethodGet DiscoveryOperationMethod = "GET"
const DiscoveryOperationMethodPost DiscoveryOperationMethod = "POST"
const DiscoveryOperationMethodHead DiscoveryOperationMethod = "HEAD"
const DiscoveryOperationMethodOptions DiscoveryOperationMethod = "OPTIONS"
const DiscoveryOperationMethodPut DiscoveryOperationMethod = "PUT"
const DiscoveryOperationMethodDelete DiscoveryOperationMethod = "DELETE"
const DiscoveryOperationMethodConnect DiscoveryOperationMethod = "CONNECT"
const DiscoveryOperationMethodPatch DiscoveryOperationMethod = "PATCH"
const DiscoveryOperationMethodTrace DiscoveryOperationMethod = "TRACE"
Origin []DiscoveryOperationOrigin

API discovery engine(s) that discovered this operation

One of the following:
const DiscoveryOperationOriginMl DiscoveryOperationOrigin = "ML"
const DiscoveryOperationOriginSessionIdentifier DiscoveryOperationOrigin = "SessionIdentifier"
const DiscoveryOperationOriginLabelDiscovery DiscoveryOperationOrigin = "LabelDiscovery"
State DiscoveryOperationState

State of operation in API Discovery

  • review - Operation is not saved into API Shield Endpoint Management
  • saved - Operation is saved into API Shield Endpoint Management
  • ignored - Operation is marked as ignored
One of the following:
const DiscoveryOperationStateReview DiscoveryOperationState = "review"
const DiscoveryOperationStateSaved DiscoveryOperationState = "saved"
const DiscoveryOperationStateIgnored DiscoveryOperationState = "ignored"
Features DiscoveryOperationFeaturesOptional
TrafficStats DiscoveryOperationFeaturesTrafficStatsOptional
LastUpdated Time
formatdate-time
PeriodSeconds int64

The period in seconds these statistics were computed over

Requests float64

The average number of requests seen during this period

formatfloat

Retrieve discovered operations on a zone

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  page, err := client.APIGateway.Discovery.Operations.List(context.TODO(), api_gateway.DiscoveryOperationListParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "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": [
    {
      "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
      "endpoint": "/api/v1/users/{var1}",
      "host": "www.example.com",
      "last_updated": "2014-01-01T05:20:00.12345Z",
      "method": "GET",
      "origin": [
        "ML"
      ],
      "state": "review",
      "features": {
        "traffic_stats": {
          "last_updated": "2014-01-01T05:20:00.12345Z",
          "period_seconds": 3600,
          "requests": 1987.06
        }
      }
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}
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": [
    {
      "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
      "endpoint": "/api/v1/users/{var1}",
      "host": "www.example.com",
      "last_updated": "2014-01-01T05:20:00.12345Z",
      "method": "GET",
      "origin": [
        "ML"
      ],
      "state": "review",
      "features": {
        "traffic_stats": {
          "last_updated": "2014-01-01T05:20:00.12345Z",
          "period_seconds": 3600,
          "requests": 1987.06
        }
      }
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}