## Add operations to a zone `client.APIGateway.Operations.BulkNew(ctx, params) (*SinglePage[OperationBulkNewResponse], error)` **post** `/zones/{zone_id}/api_gateway/operations` Add one or more operations to a zone. Endpoints can contain path variables. Host, method, endpoint will be normalized to a canoncial form when creating an operation and must be unique on the zone. Inserting an operation that matches an existing one will return the record of the already existing operation and update its last_updated date. ### Parameters - `params OperationBulkNewParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Body param.Field[[]OperationBulkNewParamsBody]` Body param - `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 OperationBulkNewParamsBodyMethod` The HTTP method used to access the endpoint. - `const OperationBulkNewParamsBodyMethodGet OperationBulkNewParamsBodyMethod = "GET"` - `const OperationBulkNewParamsBodyMethodPost OperationBulkNewParamsBodyMethod = "POST"` - `const OperationBulkNewParamsBodyMethodHead OperationBulkNewParamsBodyMethod = "HEAD"` - `const OperationBulkNewParamsBodyMethodOptions OperationBulkNewParamsBodyMethod = "OPTIONS"` - `const OperationBulkNewParamsBodyMethodPut OperationBulkNewParamsBodyMethod = "PUT"` - `const OperationBulkNewParamsBodyMethodDelete OperationBulkNewParamsBodyMethod = "DELETE"` - `const OperationBulkNewParamsBodyMethodConnect OperationBulkNewParamsBodyMethod = "CONNECT"` - `const OperationBulkNewParamsBodyMethodPatch OperationBulkNewParamsBodyMethod = "PATCH"` - `const OperationBulkNewParamsBodyMethodTrace OperationBulkNewParamsBodyMethod = "TRACE"` ### Returns - `type OperationBulkNewResponse 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 OperationBulkNewResponseMethod` The HTTP method used to access the endpoint. - `const OperationBulkNewResponseMethodGet OperationBulkNewResponseMethod = "GET"` - `const OperationBulkNewResponseMethodPost OperationBulkNewResponseMethod = "POST"` - `const OperationBulkNewResponseMethodHead OperationBulkNewResponseMethod = "HEAD"` - `const OperationBulkNewResponseMethodOptions OperationBulkNewResponseMethod = "OPTIONS"` - `const OperationBulkNewResponseMethodPut OperationBulkNewResponseMethod = "PUT"` - `const OperationBulkNewResponseMethodDelete OperationBulkNewResponseMethod = "DELETE"` - `const OperationBulkNewResponseMethodConnect OperationBulkNewResponseMethod = "CONNECT"` - `const OperationBulkNewResponseMethodPatch OperationBulkNewResponseMethod = "PATCH"` - `const OperationBulkNewResponseMethodTrace OperationBulkNewResponseMethod = "TRACE"` - `OperationID string` UUID. - `Features OperationBulkNewResponseFeatures` - `type OperationBulkNewResponseFeaturesAPIShieldOperationFeatureThresholds struct{…}` - `Thresholds OperationBulkNewResponseFeaturesAPIShieldOperationFeatureThresholdsThresholds` - `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 OperationBulkNewResponseFeaturesAPIShieldOperationFeatureParameterSchemas struct{…}` - `ParameterSchemas OperationBulkNewResponseFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemas` - `LastUpdated Time` - `ParameterSchemas OperationBulkNewResponseFeaturesAPIShieldOperationFeatureParameterSchemasParameterSchemasParameterSchemas` 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 OperationBulkNewResponseFeaturesAPIShieldOperationFeatureAPIRouting struct{…}` - `APIRouting OperationBulkNewResponseFeaturesAPIShieldOperationFeatureAPIRoutingAPIRouting` API Routing settings on endpoint. - `LastUpdated Time` - `Route string` Target route. - `type OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervals struct{…}` - `ConfidenceIntervals OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervals` - `LastUpdated Time` - `SuggestedThreshold OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThreshold` - `ConfidenceIntervals OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervals` - `P90 OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP90` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `P95 OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP95` Upper and lower bound for percentile estimate - `Lower float64` Lower bound for percentile estimate - `Upper float64` Upper bound for percentile estimate - `P99 OperationBulkNewResponseFeaturesAPIShieldOperationFeatureConfidenceIntervalsConfidenceIntervalsSuggestedThresholdConfidenceIntervalsP99` 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 OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfo struct{…}` - `SchemaInfo OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfo` - `ActiveSchema OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoActiveSchema` 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 OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction` Action taken on requests failing validation. - `const OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionNone OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "none"` - `const OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionLog OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "log"` - `const OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationActionBlock OperationBulkNewResponseFeaturesAPIShieldOperationFeatureSchemaInfoSchemaInfoMitigationAction = "block"` ### 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.Operations.BulkNew(context.TODO(), api_gateway.OperationBulkNewParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: []api_gateway.OperationBulkNewParamsBody{api_gateway.OperationBulkNewParamsBody{ Endpoint: cloudflare.F("/api/v1/users/{var1}"), Host: cloudflare.F("www.example.com"), Method: cloudflare.F(api_gateway.OperationBulkNewParamsBodyMethodGet), }}, }) 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 } ```