# User Schemas ## Retrieve information about all schemas on a zone `client.APIGateway.UserSchemas.List(ctx, params) (*V4PagePaginationArray[OldPublicSchema], error)` **get** `/zones/{zone_id}/api_gateway/user_schemas` Lists all OpenAPI schemas uploaded to API Shield for the zone, including their validation status and associated operations. ### Parameters - `params UserSchemaListParams` - `ZoneID param.Field[string]` Path param: Identifier. - `OmitSource param.Field[bool]` Query param: Omit the source-files of schemas and only retrieve their meta-data. - `Page param.Field[int64]` Query param: Page number of paginated results. - `PerPage param.Field[int64]` Query param: Maximum number of results per page. - `ValidationEnabled param.Field[bool]` Query param: Flag whether schema is enabled for validation. ### Returns - `type OldPublicSchema struct{…}` - `CreatedAt Time` - `Kind OldPublicSchemaKind` Kind of schema - `const OldPublicSchemaKindOpenAPIV3 OldPublicSchemaKind = "openapi_v3"` - `Name string` Name of the schema - `SchemaID string` UUID. - `Source string` Source of the schema - `ValidationEnabled bool` Flag whether schema is enabled for validation. ### Example ```go 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.UserSchemas.List(context.TODO(), api_gateway.UserSchemaListParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": [ { "created_at": "2014-01-01T05:20:00.12345Z", "kind": "openapi_v3", "name": "petstore schema", "schema_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "source": "", "validation_enabled": true } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Retrieve information about a specific schema on a zone `client.APIGateway.UserSchemas.Get(ctx, schemaID, params) (*OldPublicSchema, error)` **get** `/zones/{zone_id}/api_gateway/user_schemas/{schema_id}` Gets detailed information about a specific uploaded OpenAPI schema, including its contents and validation configuration. ### Parameters - `schemaID string` - `params UserSchemaGetParams` - `ZoneID param.Field[string]` Path param: Identifier. - `OmitSource param.Field[bool]` Query param: Omit the source-files of schemas and only retrieve their meta-data. ### Returns - `type OldPublicSchema struct{…}` - `CreatedAt Time` - `Kind OldPublicSchemaKind` Kind of schema - `const OldPublicSchemaKindOpenAPIV3 OldPublicSchemaKind = "openapi_v3"` - `Name string` Name of the schema - `SchemaID string` UUID. - `Source string` Source of the schema - `ValidationEnabled bool` Flag whether schema is enabled for validation. ### Example ```go 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"), ) oldPublicSchema, err := client.APIGateway.UserSchemas.Get( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", api_gateway.UserSchemaGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", oldPublicSchema.SchemaID) } ``` #### Response ```json { "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": { "created_at": "2014-01-01T05:20:00.12345Z", "kind": "openapi_v3", "name": "petstore schema", "schema_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "source": "", "validation_enabled": true }, "success": true } ``` ## Upload a schema to a zone `client.APIGateway.UserSchemas.New(ctx, params) (*UserSchemaNewResponse, error)` **post** `/zones/{zone_id}/api_gateway/user_schemas` Upload a schema to a zone ### Parameters - `params UserSchemaNewParams` - `ZoneID param.Field[string]` Path param: Identifier. - `File param.Field[Reader]` Body param: Schema file bytes - `Kind param.Field[UserSchemaNewParamsKind]` Body param: Kind of schema - `const UserSchemaNewParamsKindOpenAPIV3 UserSchemaNewParamsKind = "openapi_v3"` - `Name param.Field[string]` Body param: Name of the schema - `ValidationEnabled param.Field[UserSchemaNewParamsValidationEnabled]` Body param: Flag whether schema is enabled for validation. - `const UserSchemaNewParamsValidationEnabledTrue UserSchemaNewParamsValidationEnabled = "true"` - `const UserSchemaNewParamsValidationEnabledFalse UserSchemaNewParamsValidationEnabled = "false"` ### Returns - `type UserSchemaNewResponse struct{…}` - `Schema OldPublicSchema` - `CreatedAt Time` - `Kind OldPublicSchemaKind` Kind of schema - `const OldPublicSchemaKindOpenAPIV3 OldPublicSchemaKind = "openapi_v3"` - `Name string` Name of the schema - `SchemaID string` UUID. - `Source string` Source of the schema - `ValidationEnabled bool` Flag whether schema is enabled for validation. - `UploadDetails UserSchemaNewResponseUploadDetails` - `Warnings []UserSchemaNewResponseUploadDetailsWarning` Diagnostic warning events that occurred during processing. These events are non-critical errors found within the schema. - `Code int64` Code that identifies the event that occurred. - `Locations []string` JSONPath location(s) in the schema where these events were encountered. See for JSONPath specification. - `Message string` Diagnostic message that describes the event. ### Example ```go package main import ( "bytes" "context" "fmt" "io" "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"), ) userSchema, err := client.APIGateway.UserSchemas.New(context.TODO(), api_gateway.UserSchemaNewParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), File: cloudflare.F(io.Reader(bytes.NewBuffer([]byte("Example data")))), Kind: cloudflare.F(api_gateway.UserSchemaNewParamsKindOpenAPIV3), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", userSchema.Schema) } ``` #### Response ```json { "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": { "schema": { "created_at": "2014-01-01T05:20:00.12345Z", "kind": "openapi_v3", "name": "petstore schema", "schema_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "source": "", "validation_enabled": true }, "upload_details": { "warnings": [ { "code": 28, "locations": [ ".paths[\"/user/{username}\"].put" ], "message": "unsupported media type: application/octet-stream" } ] } }, "success": true } ``` ## Enable validation for a schema `client.APIGateway.UserSchemas.Edit(ctx, schemaID, params) (*OldPublicSchema, error)` **patch** `/zones/{zone_id}/api_gateway/user_schemas/{schema_id}` Activates schema validation for an uploaded OpenAPI schema. Requests to matching endpoints will be validated against the schema definitions. ### Parameters - `schemaID string` - `params UserSchemaEditParams` - `ZoneID param.Field[string]` Path param: Identifier. - `ValidationEnabled param.Field[UserSchemaEditParamsValidationEnabled]` Body param: Flag whether schema is enabled for validation. - `const UserSchemaEditParamsValidationEnabledTrue UserSchemaEditParamsValidationEnabled = true` ### Returns - `type OldPublicSchema struct{…}` - `CreatedAt Time` - `Kind OldPublicSchemaKind` Kind of schema - `const OldPublicSchemaKindOpenAPIV3 OldPublicSchemaKind = "openapi_v3"` - `Name string` Name of the schema - `SchemaID string` UUID. - `Source string` Source of the schema - `ValidationEnabled bool` Flag whether schema is enabled for validation. ### Example ```go 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"), ) oldPublicSchema, err := client.APIGateway.UserSchemas.Edit( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", api_gateway.UserSchemaEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", oldPublicSchema.SchemaID) } ``` #### Response ```json { "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": { "created_at": "2014-01-01T05:20:00.12345Z", "kind": "openapi_v3", "name": "petstore schema", "schema_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "source": "", "validation_enabled": true }, "success": true } ``` ## Delete a schema `client.APIGateway.UserSchemas.Delete(ctx, schemaID, body) (*UserSchemaDeleteResponse, error)` **delete** `/zones/{zone_id}/api_gateway/user_schemas/{schema_id}` Permanently removes an uploaded OpenAPI schema from API Shield schema validation. Operations using this schema will lose their validation rules. ### Parameters - `schemaID string` - `body UserSchemaDeleteParams` - `ZoneID param.Field[string]` Identifier. ### Returns - `type UserSchemaDeleteResponse struct{…}` - `Errors Message` - `Code int64` - `Message string` - `DocumentationURL string` - `Source MessageItemSource` - `Pointer string` - `Messages Message` - `Success UserSchemaDeleteResponseSuccess` Whether the API call was successful. - `const UserSchemaDeleteResponseSuccessTrue UserSchemaDeleteResponseSuccess = true` ### Example ```go 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"), ) userSchema, err := client.APIGateway.UserSchemas.Delete( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", api_gateway.UserSchemaDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", userSchema.Errors) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true } ``` ## Domain Types ### Message - `type Message []MessageItem` - `Code int64` - `Message string` - `DocumentationURL string` - `Source MessageItemSource` - `Pointer string` ### Old Public Schema - `type OldPublicSchema struct{…}` - `CreatedAt Time` - `Kind OldPublicSchemaKind` Kind of schema - `const OldPublicSchemaKindOpenAPIV3 OldPublicSchemaKind = "openapi_v3"` - `Name string` Name of the schema - `SchemaID string` UUID. - `Source string` Source of the schema - `ValidationEnabled bool` Flag whether schema is enabled for validation. # Operations ## Retrieve all operations from a schema. `client.APIGateway.UserSchemas.Operations.List(ctx, schemaID, params) (*V4PagePaginationArray[UserSchemaOperationListResponse], error)` **get** `/zones/{zone_id}/api_gateway/user_schemas/{schema_id}/operations` Retrieves all operations from the schema. Operations that already exist in API Shield Endpoint Management will be returned as full operations. ### Parameters - `schemaID string` - `params UserSchemaOperationListParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Endpoint param.Field[string]` Query param: Filter results to only include endpoints containing this pattern. - `Feature param.Field[[]UserSchemaOperationListParamsFeature]` Query param: Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning. - `const UserSchemaOperationListParamsFeatureThresholds UserSchemaOperationListParamsFeature = "thresholds"` - `const UserSchemaOperationListParamsFeatureParameterSchemas UserSchemaOperationListParamsFeature = "parameter_schemas"` - `const UserSchemaOperationListParamsFeatureSchemaInfo UserSchemaOperationListParamsFeature = "schema_info"` - `Host param.Field[[]string]` Query param: Filter results to only include the specified hosts. - `Method param.Field[[]string]` Query param: Filter results to only include the specified HTTP methods. - `OperationStatus param.Field[UserSchemaOperationListParamsOperationStatus]` Query param: Filter results by whether operations exist in API Shield Endpoint Management or not. `new` will just return operations from the schema that do not exist in API Shield Endpoint Management. `existing` will just return operations from the schema that already exist in API Shield Endpoint Management. - `const UserSchemaOperationListParamsOperationStatusNew UserSchemaOperationListParamsOperationStatus = "new"` - `const UserSchemaOperationListParamsOperationStatusExisting UserSchemaOperationListParamsOperationStatus = "existing"` - `Page param.Field[int64]` Query param: Page number of paginated results. - `PerPage param.Field[int64]` Query param: Maximum number of results per page. ### Returns - `type UserSchemaOperationListResponse interface{…}` - `type UserSchemaOperationListResponseAPIShieldOperation struct{…}` - `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/. - `Host string` RFC3986-compliant host. - `LastUpdated Time` - `Method UserSchemaOperationListResponseAPIShieldOperationMethod` The HTTP method used to access the endpoint. - `const UserSchemaOperationListResponseAPIShieldOperationMethodGet UserSchemaOperationListResponseAPIShieldOperationMethod = "GET"` - `const UserSchemaOperationListResponseAPIShieldOperationMethodPost UserSchemaOperationListResponseAPIShieldOperationMethod = "POST"` - `const UserSchemaOperationListResponseAPIShieldOperationMethodHead UserSchemaOperationListResponseAPIShieldOperationMethod = "HEAD"` - `const UserSchemaOperationListResponseAPIShieldOperationMethodOptions UserSchemaOperationListResponseAPIShieldOperationMethod = "OPTIONS"` - `const UserSchemaOperationListResponseAPIShieldOperationMethodPut UserSchemaOperationListResponseAPIShieldOperationMethod = "PUT"` - `const UserSchemaOperationListResponseAPIShieldOperationMethodDelete UserSchemaOperationListResponseAPIShieldOperationMethod = "DELETE"` - `const UserSchemaOperationListResponseAPIShieldOperationMethodConnect UserSchemaOperationListResponseAPIShieldOperationMethod = "CONNECT"` - `const UserSchemaOperationListResponseAPIShieldOperationMethodPatch UserSchemaOperationListResponseAPIShieldOperationMethod = "PATCH"` - `const UserSchemaOperationListResponseAPIShieldOperationMethodTrace UserSchemaOperationListResponseAPIShieldOperationMethod = "TRACE"` - `OperationID string` UUID. - `Features UserSchemaOperationListResponseAPIShieldOperationFeatures` - `type UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureThresholds struct{…}` - `Thresholds UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureThresholdsThresholds` - `AuthIDTokens int64` The total number of auth-ids seen across this calculation. - `DataPoints int64` The number of data points used for the threshold suggestion calculation. - `LastUpdated Time` - `P50 int64` The p50 quantile of requests (in period_seconds). - `P90 int64` The p90 quantile of requests (in period_seconds). - `P99 int64` The p99 quantile of requests (in period_seconds). - `PeriodSeconds int64` The period over which this threshold is suggested. - `Requests int64` The estimated number of requests covered by these calculations. - `SuggestedThreshold int64` The suggested threshold in requests done by the same auth_id or period_seconds. - `type UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemas struct{…}` - `ParameterSchemas UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas` - `LastUpdated Time` - `ParameterSchemas UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas` An operation schema object containing a response. - `Parameters []unknown` An array containing the learned parameter schemas. - `Responses unknown` An empty response object. This field is required to yield a valid operation schema. - `type UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureAPIRouting struct{…}` - `APIRouting UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting` API Routing settings on endpoint. - `LastUpdated Time` - `Route string` Target route. - `type UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervals struct{…}` - `ConfidenceIntervals UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals` - `LastUpdated Time` - `SuggestedThreshold UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold` - `ConfidenceIntervals UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals` - `P90 UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `P95 UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `P99 UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `Mean float64` Suggested threshold. - `type UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfo struct{…}` - `SchemaInfo UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo` - `ActiveSchema UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema` Schema active on endpoint. - `ID string` UUID. - `CreatedAt Time` - `IsLearned bool` True if schema is Cloudflare-provided. - `Name string` Schema file name. - `LearnedAvailable bool` True if a Cloudflare-provided learned schema is available for this endpoint. - `MitigationAction UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction` Action taken on requests failing validation. - `const UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionNone UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "none"` - `const UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionLog UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "log"` - `const UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionBlock UserSchemaOperationListResponseAPIShieldOperationFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "block"` - `type UserSchemaOperationListResponseAPIShieldBasicOperation struct{…}` - `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/. - `Host string` RFC3986-compliant host. - `Method UserSchemaOperationListResponseAPIShieldBasicOperationMethod` The HTTP method used to access the endpoint. - `const UserSchemaOperationListResponseAPIShieldBasicOperationMethodGet UserSchemaOperationListResponseAPIShieldBasicOperationMethod = "GET"` - `const UserSchemaOperationListResponseAPIShieldBasicOperationMethodPost UserSchemaOperationListResponseAPIShieldBasicOperationMethod = "POST"` - `const UserSchemaOperationListResponseAPIShieldBasicOperationMethodHead UserSchemaOperationListResponseAPIShieldBasicOperationMethod = "HEAD"` - `const UserSchemaOperationListResponseAPIShieldBasicOperationMethodOptions UserSchemaOperationListResponseAPIShieldBasicOperationMethod = "OPTIONS"` - `const UserSchemaOperationListResponseAPIShieldBasicOperationMethodPut UserSchemaOperationListResponseAPIShieldBasicOperationMethod = "PUT"` - `const UserSchemaOperationListResponseAPIShieldBasicOperationMethodDelete UserSchemaOperationListResponseAPIShieldBasicOperationMethod = "DELETE"` - `const UserSchemaOperationListResponseAPIShieldBasicOperationMethodConnect UserSchemaOperationListResponseAPIShieldBasicOperationMethod = "CONNECT"` - `const UserSchemaOperationListResponseAPIShieldBasicOperationMethodPatch UserSchemaOperationListResponseAPIShieldBasicOperationMethod = "PATCH"` - `const UserSchemaOperationListResponseAPIShieldBasicOperationMethodTrace UserSchemaOperationListResponseAPIShieldBasicOperationMethod = "TRACE"` ### Example ```go 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.UserSchemas.Operations.List( context.TODO(), "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", api_gateway.UserSchemaOperationListParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": [ { "endpoint": "/api/v1/users/{var1}", "host": "www.example.com", "last_updated": "2014-01-01T05:20:00.12345Z", "method": "GET", "operation_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "features": { "thresholds": { "auth_id_tokens": 0, "data_points": 0, "last_updated": "2014-01-01T05:20:00.12345Z", "p50": 0, "p90": 0, "p99": 0, "period_seconds": 0, "requests": 0, "suggested_threshold": 0 } } } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` # Hosts ## Retrieve schema hosts in a zone `client.APIGateway.UserSchemas.Hosts.List(ctx, params) (*V4PagePaginationArray[UserSchemaHostListResponse], error)` **get** `/zones/{zone_id}/api_gateway/user_schemas/hosts` Lists all unique hosts found in uploaded OpenAPI schemas for the zone. Useful for understanding which domains have schema coverage. ### Parameters - `params UserSchemaHostListParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Page param.Field[int64]` Query param: Page number of paginated results. - `PerPage param.Field[int64]` Query param: Maximum number of results per page. ### Returns - `type UserSchemaHostListResponse struct{…}` - `CreatedAt Time` - `Hosts []string` Hosts serving the schema, e.g zone.host.com - `Name string` Name of the schema - `SchemaID string` UUID. ### Example ```go 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.UserSchemas.Hosts.List(context.TODO(), api_gateway.UserSchemaHostListParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "created_at": "2014-01-01T05:20:00.12345Z", "hosts": [ "string" ], "name": "petstore schema", "schema_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ```