### Get Device Example Source: https://developers.cloudflare.com/api/go/resources/zero_trust/subresources/devices/methods/get This example shows a successful response when retrieving device details. ```APIDOC ## Get Device ### Description Retrieves details for a specific device. ### Method GET ### Endpoint `/accounts/{accountId}/devices/{deviceId}` ### Response #### Success Response (200) - **result** (object) - Contains the device details. - **id** (string) - The unique identifier of the device. - **account** (object) - Information about the account the device belongs to. - **id** (string) - The account ID. - **account_type** (string) - The type of the account. - **name** (string) - The name of the account. - **created** (string) - The timestamp when the device was created. - **deleted** (boolean) - Indicates if the device has been deleted. - **device_type** (string) - The type of the device (e.g., 'windows'). - **gateway_device_id** (string) - The ID of the gateway device. - **ip** (string) - The IP address of the device. - **key** (string) - The device's security key. - **key_type** (string) - The type of the security key. - **last_seen** (string) - The timestamp when the device was last seen. - **mac_address** (string) - The MAC address of the device. - **model** (string) - The model of the device. - **name** (string) - The name of the device. - **os_version** (string) - The operating system version of the device. - **serial_number** (string) - The serial number of the device. - **tunnel_type** (string) - The type of tunnel used by the device. - **updated** (string) - The timestamp when the device was last updated. - **user** (object) - Information about the user associated with the device. - **id** (string) - The user ID. - **email** (string) - The user's email address. - **name** (string) - The user's name. - **version** (string) - The version of the device software. ### Response Example ```json { "errors": [], "messages": [], "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "account": { "id": "id", "account_type": "account_type", "name": "Company" }, "created": "2017-06-14T00:00:00Z", "deleted": true, "device_type": "windows", "gateway_device_id": "PD33E90AXfafe14643cbbbc-4a0ed4fc8415Q", "ip": "1.1.1.1", "key": "yek0SUYoOQ10vMGsIYAevozXUQpQtNFJFfFGqER/BGc=", "key_type": "curve25519", "last_seen": "2017-06-14T00:00:00Z", "mac_address": "00-00-5E-00-53-00", "model": "MyPhone(pro-X)", "name": "My mobile device", "os_version": "10.0.0", "serial_number": "EXAMPLEHMD6R", "tunnel_type": "masque", "updated": "2017-06-14T00:00:00Z", "user": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "email": "user@example.com", "name": "John Appleseed" }, "version": "1.0.0" }, "success": true } ``` ``` -------------------------------- ### Get On-Ramp Example Source: https://developers.cloudflare.com/api/go/resources/magic_cloud_networking/subresources/on_ramps/methods/get This example demonstrates how to fetch the details of an on-ramp. ```APIDOC ## GET /magic_cloud_networking/on_ramps/{on_ramp_id} ### Description Retrieves details of a specific on-ramp. ### Method GET ### Endpoint /magic_cloud_networking/on_ramps/{on_ramp_id} ### Parameters #### Path Parameters - **on_ramp_id** (string) - Required - The unique identifier of the on-ramp. ### Response #### Success Response (200) - **errors** (array) - Contains a list of errors, if any. - **messages** (array) - Contains a list of messages, if any. - **result** (object) - Contains the on-ramp details. - **id** (string) - The unique identifier of the on-ramp. - **cloud_type** (string) - The type of cloud provider (e.g., AWS, Azure, GCP). - **dynamic_routing** (boolean) - Whether dynamic routing is enabled. - **install_routes_in_cloud** (boolean) - Whether to install routes in the cloud provider. - **install_routes_in_magic_wan** (boolean) - Whether to install routes in Magic WAN. - **name** (string) - The name of the on-ramp. - **type** (string) - The type of the on-ramp (e.g., OnrampTypeSingle). - **updated_at** (string) - The timestamp when the on-ramp was last updated. - **attached_hubs** (array) - A list of hub identifiers attached to the on-ramp. - **attached_vpcs** (array) - A list of VPC identifiers attached to the on-ramp. - **cloud_asn** (integer) - The ASN of the cloud provider. - **description** (string) - A description of the on-ramp. - **hub** (string) - The identifier of the hub associated with the on-ramp. - **last_applied_at** (string) - The timestamp of the last successful application. - **last_exported_at** (string) - The timestamp of the last export. - **last_planned_at** (string) - The timestamp of the last planning operation. - **manage_hub_to_hub_attachments** (boolean) - Whether to manage hub-to-hub attachments. - **manage_vpc_to_hub_attachments** (boolean) - Whether to manage VPC-to-hub attachments. - **planned_monthly_cost_estimate** (object) - Estimated monthly cost after planning. - **planned_resources** (array) - List of planned resources. - **planned_resources_unavailable** (boolean) - Indicates if planned resources are unavailable. - **post_apply_monthly_cost_estimate** (object) - Estimated monthly cost after application. - **post_apply_resources** (object) - Resources after application. - **region** (string) - The region of the on-ramp. - **status** (object) - The status of the on-ramp. #### Response Example ```json { "errors": [ { "code": 1001, "message": "message", "documentation_url": "documentation_url", "meta": { "l10n_key": "l10n_key", "loggable_error": "loggable_error", "template_data": {}, "trace_id": "trace_id" }, "source": { "parameter": "parameter", "parameter_value_index": 0, "pointer": "pointer" } } ], "messages": [ { "code": 1001, "message": "message", "documentation_url": "documentation_url", "meta": { "l10n_key": "l10n_key", "loggable_error": "loggable_error", "template_data": {}, "trace_id": "trace_id" }, "source": { "parameter": "parameter", "parameter_value_index": 0, "pointer": "pointer" } } ], "result": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "cloud_type": "AWS", "dynamic_routing": true, "install_routes_in_cloud": true, "install_routes_in_magic_wan": true, "name": "name", "type": "OnrampTypeSingle", "updated_at": "updated_at", "attached_hubs": [ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" ], "attached_vpcs": [ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" ], "cloud_asn": 0, "description": "description", "hub": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "last_applied_at": "last_applied_at", "last_exported_at": "last_exported_at", "last_planned_at": "last_planned_at", "manage_hub_to_hub_attachments": true, "manage_vpc_to_hub_attachments": true, "planned_monthly_cost_estimate": { "currency": "currency", "current_monthly_cost": 0, "diff": 0, "proposed_monthly_cost": 0 }, "planned_resources": [ { "diff": { "diff": "diff", "left_description": "left_description", "left_yaml": "left_yaml", "right_description": "right_description", "right_yaml": "right_yaml" }, "keys_require_replace": [ "string" ], "monthly_cost_estimate_diff": { "currency": "currency", "current_monthly_cost": 0, "diff": 0, "proposed_monthly_cost": 0 }, "planned_action": "no_op", "resource": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "cloud_type": "AWS", "detail": "detail", "name": "name", "resource_type": "aws_customer_gateway", "title": "title" } } ], "planned_resources_unavailable": true, "post_apply_monthly_cost_estimate": { "currency": "currency", "monthly_cost": 0 }, "post_apply_resources": { "foo": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "account_id": "account_id", "cloud_type": "AWS", "config": { "foo": "bar" }, "deployment_provider": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "managed": true, "monthly_cost_estimate": { "currency": "currency", "monthly_cost": 0 }, "name": "name", "native_id": "native_id", "observations": { "foo": { "first_observed_at": "first_observed_at", "last_observed_at": "last_observed_at", "provider_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "resource_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" } }, "provider_ids": [ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" ], "provider_names_by_id": { "foo": "string" }, "region": "region", "resource_group": "resource_group", "resource_type": "aws_customer_gateway", "sections": [ { "hidden_items": [ { "helpText": "helpText", "name": "name", "value": { "item_type": "item_type", "string": "string" } } ], "name": "name", "visible_items": [ { "helpText": "helpText", "name": "name", "value": { "item_type": "item_type", "string": "string" } } ], "help_text": "help_text" } ], "state": { "foo": "bar" }, "tags": { "foo": "string" }, "updated_at": "updated_at", "url": "url", "managed_by": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "client_type": "MAGIC_WAN_CLOUD_ONRAMP", "name": "name" } ] } }, "post_apply_resources_unavailable": true, "region": "region", "status": { "apply_progress": { "done": 0, "total": 0 } } } } ``` ``` -------------------------------- ### Get Cloud Integration Setup Config Source: https://developers.cloudflare.com/api/go/resources/magic_cloud_networking/subresources/cloud_integrations Retrieves the initial setup configuration for a cloud integration. ```Go client.MagicCloudNetworking.CloudIntegrations.InitialSetup(ctx, providerID, query) (*CloudIntegrationInitialSetupResponse, error) ``` ```HTTP GET/accounts/{account_id}/magic/cloud/providers/{provider_id}/initial_setup ``` -------------------------------- ### Traffic Anomaly Get Response Example Source: https://developers.cloudflare.com/api/go/resources/radar/subresources/traffic_anomalies/methods/get This is an example of a successful response when retrieving traffic anomalies. It includes details about the anomaly's start and end dates, status, type, and associated ASN and location information. ```json { "result": { "trafficAnomalies": [ { "startDate": "2023-08-02T23:15:00Z", "status": "UNVERIFIED", "type": "LOCATION", "uuid": "55a57f33-8bc0-4984-b4df-fdaff72df39d", "asnDetails": { "asn": "189", "name": "LUMEN-LEGACY-L3-PARTITION", "locations": { "code": "US", "name": "United States" } }, "endDate": "2019-12-27T18:11:19.117Z", "locationDetails": { "code": "US", "name": "United States" }, "originDetails": { "name": "us-east-1 Amazon Web Services", "origin": "amazon-us-east-1" }, "visibleInDataSources": [ "string" ] } ] }, "success": true } ``` -------------------------------- ### Create Preset Example Source: https://developers.cloudflare.com/api/go/resources/realtime_kit/subresources/presets/methods/create Demonstrates how to construct and create a new preset with detailed permissions and UI design token configurations. Ensure all required fields are populated correctly. ```go preset, err := realtime_kit.NewPreset( realtime_kit.PresetNewParams{ Name: cloudflare.F("my-preset"), Permissions: cloudflare.F(realtime_kit.PresetNewParamsPermissions{ CanConfigure: cloudflare.F(true), CanDelete: cloudflare.F(true), CanEdit: cloudflare.F(true), CanInvite: cloudflare.F(true), CanJoin: cloudflare.F(true), CanLeave: cloudflare.F(true), CanManage: cloudflare.F(true), CanMute: cloudflare.F(true), CanRecord: cloudflare.F(true), CanReplay: cloudflare.F(true), CanSee: cloudflare.F(true), CanShare: cloudflare.F(true), CanStart: cloudflare.F(true), CanStop: cloudflare.F(true), CanUnmute: cloudflare.F(true), CanUpdate: cloudflare.F(true), Polls: cloudflare.F(realtime_kit.PresetNewParamsPermissionsPolls{ CanCreate: cloudflare.F(true), CanView: cloudflare.F(true), CanVote: cloudflare.F(true), }), RecorderType: cloudflare.F(realtime_kit.PresetNewParamsPermissionsRecorderTypeRecorder), ShowParticipantList: cloudflare.F(true), WaitingRoomType: cloudflare.F(realtime_kit.PresetNewParamsPermissionsWaitingRoomTypeSkip), }), UI: cloudflare.F(realtime_kit.PresetNewParamsUI{ DesignTokens: cloudflare.F(realtime_kit.PresetNewParamsUIDesignTokens{ BorderRadius: cloudflare.F(realtime_kit.PresetNewParamsUIDesignTokensBorderRadiusSharp), BorderWidth: cloudflare.F(realtime_kit.PresetNewParamsUIDesignTokensBorderWidthNone), Colors: cloudflare.F(realtime_kit.PresetNewParamsUIDesignTokensColors{ Background: cloudflare.F(realtime_kit.PresetNewParamsUIDesignTokensColorsBackground{ Number600: cloudflare.F("600"), Number700: cloudflare.F("700"), Number800: cloudflare.F("800"), Number900: cloudflare.F("900"), Number1000: cloudflare.F("1000"), }), Brand: cloudflare.F(realtime_kit.PresetNewParamsUIDesignTokensColorsBrand{ Number300: cloudflare.F("300"), Number400: cloudflare.F("400"), Number500: cloudflare.F("500"), Number600: cloudflare.F("600"), Number700: cloudflare.F("700"), }), Danger: cloudflare.F("danger"), Success: cloudflare.F("success"), Text: cloudflare.F("text"), TextOnBrand: cloudflare.F("text_on_brand"), VideoBg: cloudflare.F("video_bg"), Warning: cloudflare.F("warning"), }), SpacingBase: cloudflare.F(0.000000), Theme: cloudflare.F(realtime_kit.PresetNewParamsUIDesignTokensThemeDarkest), }), }), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", preset.Data) } ``` -------------------------------- ### Create Subscription Example Source: https://developers.cloudflare.com/api/go/resources/accounts/subresources/subscriptions/methods/create This example demonstrates how to create a new subscription for an account. Ensure you have the necessary permissions and provide the correct account ID and subscription details. ```go client.Accounts.Subscriptions.New(ctx, params) ``` -------------------------------- ### Get Hostname Route Go Example Source: https://developers.cloudflare.com/api/go/resources/zero_trust/subresources/networks/subresources/hostname_routes/methods/get Demonstrates how to retrieve a hostname route using the Cloudflare Go SDK. Ensure you have the SDK installed and are authenticated with an API token. ```Go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) hostnameRoute, err := client.ZeroTrust.Networks.HostnameRoutes.Get( context.TODO(), "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", zero_trust.NetworkHostnameRouteGetParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", hostnameRoute.ID) } ``` -------------------------------- ### Get WAF Override Go Example Source: https://developers.cloudflare.com/api/go/resources/firewall/subresources/waf/subresources/overrides/methods/get Use this Go code to retrieve a WAF override by its ID and Zone ID. Ensure you have the cloudflare-go SDK installed and your API token is set. ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/firewall" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) override, err := client.Firewall.WAF.Overrides.Get( context.TODO(), "de677e5818985db1285d0e80225f06e5", firewall.WAFOverrideGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", override.ID) } ``` -------------------------------- ### Get Resource Example Source: https://developers.cloudflare.com/api/go/resources/magic_cloud_networking/subresources/resources/methods/get Demonstrates how to retrieve a specific resource using its ID. Ensure you have the necessary permissions and have initialized the client correctly. ```go client.MagicCloudNetworking.Resources.Get(ctx, resourceID, params) ``` -------------------------------- ### Get Cloudflare Tunnel Go Example Source: https://developers.cloudflare.com/api/go/resources/zero_trust/subresources/tunnels/subresources/cloudflared/methods/get Use this Go code to retrieve a Cloudflare Tunnel by its ID. Ensure you have the cloudflare-go SDK installed and provide a valid API token and Account ID. ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/zero_trust" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) cloudflareTunnel, err := client.ZeroTrust.Tunnels.Cloudflared.Get( context.TODO(), "f70ff985-a4ef-4643-bbbc-4a0ed4fc8415", zero_trust.TunnelCloudflaredGetParams{ AccountID: cloudflare.F("699d98642c564d2e855e9661899b7252"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", cloudflareTunnel.ID) } ``` -------------------------------- ### Create Preset Go Example Source: https://developers.cloudflare.com/api/go/resources/realtime_kit/subresources/presets/methods/create This Go code snippet demonstrates how to initialize the Cloudflare client and prepare for creating a new preset. Ensure you have the necessary imports and context. ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/realtime_kit" ) ``` -------------------------------- ### 200 Example Response for Cloud Integration Setup Source: https://developers.cloudflare.com/api/node/resources/magic_cloud_networking/subresources/cloud_integrations/methods/initial_setup This is an example of a successful response when retrieving the initial setup configuration for a cloud integration. The structure of the 'result' object may vary depending on the cloud provider (e.g., AWS, Azure, GCP). ```json { "errors": [ { "code": 1001, "message": "message", "documentation_url": "documentation_url", "meta": { "l10n_key": "l10n_key", "loggable_error": "loggable_error", "template_data": {}, "trace_id": "trace_id" }, "source": { "parameter": "parameter", "parameter_value_index": 0, "pointer": "pointer" } } ], "messages": [ { "code": 1001, "message": "message", "documentation_url": "documentation_url", "meta": { "l10n_key": "l10n_key", "loggable_error": "loggable_error", "template_data": {}, "trace_id": "trace_id" }, "source": { "parameter": "parameter", "parameter_value_index": 0, "pointer": "pointer" } } ], "result": { "aws_trust_policy": "aws_trust_policy", "item_type": "item_type" }, "success": true } ``` -------------------------------- ### Get Page Test Schedule Go Example Source: https://developers.cloudflare.com/api/go/resources/speed/subresources/schedule/methods/get Use this Go code to retrieve the page test schedule for a specified zone. Ensure you have the cloudflare-go SDK installed and provide a valid API token. ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/speed" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) schedule, err := client.Speed.Schedule.Get( context.TODO(), "example.com", speed.ScheduleGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", schedule.Frequency) } ``` -------------------------------- ### Get Device Example Source: https://developers.cloudflare.com/api/go/resources/zero_trust/subresources/devices/methods/get This example shows a successful response when retrieving device details. It includes information about the device's ID, account, creation and last seen timestamps, type, IP address, and associated user. ```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": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "account": { "id": "id", "account_type": "account_type", "name": "Company" }, "created": "2017-06-14T00:00:00Z", "deleted": true, "device_type": "windows", "gateway_device_id": "PD33E90AXfafe14643cbbbc-4a0ed4fc8415Q", "ip": "1.1.1.1", "key": "yek0SUYoOQ10vMGsIYAevozXUQpQtNFJFfFGqER/BGc=", "key_type": "curve25519", "last_seen": "2017-06-14T00:00:00Z", "mac_address": "00-00-5E-00-53-00", "model": "MyPhone(pro-X)", "name": "My mobile device", "os_version": "10.0.0", "serial_number": "EXAMPLEHMD6R", "tunnel_type": "masque", "updated": "2017-06-14T00:00:00Z", "user": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "email": "user@example.com", "name": "John Appleseed" }, "version": "1.0.0" }, "success": true } ``` -------------------------------- ### Get D1 Database Go Example Source: https://developers.cloudflare.com/api/go/resources/d1/subresources/database/methods/get Use this Go code to retrieve a D1 database by its UUID. Ensure you have the Cloudflare Go SDK installed and provide a valid API token and Account ID. ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/d1" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) d1, err := client.D1.Database.Get( context.TODO(), "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", d1.DatabaseGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", d1.UUID) } ``` -------------------------------- ### Create Site WAN Go Example Source: https://developers.cloudflare.com/api/go/resources/magic_transit/subresources/sites/subresources/wans/methods/create Demonstrates how to create a new Site WAN using the Cloudflare Go SDK. Ensure you have the necessary API token and site ID. The example shows basic configuration with `AccountID` and `Physport`. ```Go 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"), ) page, err := client.MagicTransit.Sites.WANs.New( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", magic_transit.SiteWANNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Physport: cloudflare.F(int64(1)), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` -------------------------------- ### Start Recording with Go SDK Source: https://developers.cloudflare.com/api/go/resources/realtime_kit/subresources/recordings/methods/start_recordings Initiates a meeting recording using the Cloudflare Go SDK. Ensure you have the SDK installed and your API token is valid. This example configures audio, video, and interactive settings for the recording. ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/realtime_kit" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.RealtimeKit.Recordings.StartRecordings( context.TODO(), "app_id", realtime_kit.RecordingStartRecordingsParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), AudioConfig: cloudflare.F(realtime_kit.RecordingStartRecordingsParamsAudioConfig{ Channel: cloudflare.F(realtime_kit.RecordingStartRecordingsParamsAudioConfigChannelStereo), Codec: cloudflare.F(realtime_kit.RecordingStartRecordingsParamsAudioConfigCodecAac), ExportFile: cloudflare.F(true), }), FileNamePrefix: cloudflare.F("string"), InteractiveConfig: cloudflare.F(realtime_kit.RecordingStartRecordingsParamsInteractiveConfig{ Type: cloudflare.F(realtime_kit.RecordingStartRecordingsParamsInteractiveConfigTypeId3), }), MaxSeconds: cloudflare.F(int64(60)), MeetingID: cloudflare.F("97440c6a-140b-40a9-9499-b23fd7a3868a"), RealtimekitBucketConfig: cloudflare.F(realtime_kit.RecordingStartRecordingsParamsRealtimekitBucketConfig{ Enabled: cloudflare.F(true), }), VideoConfig: cloudflare.F(realtime_kit.RecordingStartRecordingsParamsVideoConfig{ Codec: cloudflare.F(realtime_kit.RecordingStartRecordingsParamsVideoConfigCodecH264), ExportFile: cloudflare.F(true), Height: cloudflare.F(int64(720)), Watermark: cloudflare.F(realtime_kit.RecordingStartRecordingsParamsVideoConfigWatermark{ Position: cloudflare.F(realtime_kit.RecordingStartRecordingsParamsVideoConfigWatermarkPositionLeftTop), Size: cloudflare.F(realtime_kit.RecordingStartRecordingsParamsVideoConfigWatermarkSize{ Height: cloudflare.F(int64(1)), Width: cloudflare.F(int64(1)), }), URL: cloudflare.F("http://example.com"), }), Width: cloudflare.F(int64(1280)), }), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.Success) } ``` -------------------------------- ### Project Get Example Source: https://developers.cloudflare.com/api/go/resources/pages/subresources/projects/methods/get This is an example of a successful API response when retrieving project details. It includes information about the project's ID, canonical deployment, build configuration, environment variables, and source repository. ```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": { "id": "7b162ea7-7367-4d67-bcde-1160995d5", "canonical_deployment": { "id": "f64788e9-fccd-4d4a-a28a-cb84f88f6", "aliases": [ "https://branchname.projectname.pages.dev" ], "build_config": { "web_analytics_tag": "cee1c73f6e4743d0b5e6bb1a0bcaabcc", "web_analytics_token": "021e1057c18547eca7b79f2516f06o7x", "build_caching": true, "build_command": "npm run build", "destination_dir": "build", "root_dir": "/" }, "created_on": "2021-03-09T00:55:03.923456Z", "deployment_trigger": { "metadata": { "branch": "main", "commit_dirty": false, "commit_hash": "ad9ccd918a81025731e10e40267e11273a263421", "commit_message": "Update index.html" }, "type": "ad_hoc" }, "env_vars": { "foo": { "type": "plain_text", "value": "hello world" } }, "environment": "preview", "is_skipped": true, "latest_stage": { "ended_on": "2021-03-09T00:58:59.045655Z", "name": "deploy", "started_on": "2021-03-09T00:55:03.923456Z", "status": "success" }, "modified_on": "2021-03-09T00:58:59.045655Z", "project_id": "7b162ea7-7367-4d67-bcde-1160995d5", "project_name": "this-is-my-project-01", "short_id": "f64788e9", "source": { "config": { "deployments_enabled": true, "owner": "my-org", "owner_id": "12345678", "path_excludes": [ "string" ], "path_includes": [ "string" ], "pr_comments_enabled": true, "preview_branch_excludes": [ ``` ```json "string" ], "preview_branch_includes": [ "string" ], "preview_deployment_setting": "all", "production_branch": "main", "production_deployments_enabled": true, "repo_id": "12345678", "repo_name": "my-repo" }, "type": "github" }, "stages": [ { "ended_on": "2021-06-03T15:39:03.134378Z", "name": "queued", "started_on": "2021-06-03T15:38:15.608194Z", "status": "active" }, { "ended_on": null, "name": "initialize", "started_on": null, "status": "idle" }, { "ended_on": null, "name": "clone_repo", "started_on": null, "status": "idle" }, { "ended_on": null, "name": "build", "started_on": null, "status": "idle" }, { "ended_on": null, "name": "deploy", "started_on": null, "status": "idle" } ], "url": "https://f64788e9.ninjakittens.pages.dev", "uses_functions": true }, "created_on": "2017-01-01T00:00:00Z", "deployment_configs": { "preview": { "always_use_latest_compatibility_date": false, "build_image_major_version": 3, "compatibility_date": "2025-01-01", "compatibility_flags": [ "url_standard" ], "env_vars": { "foo": { "type": "plain_text", "value": "hello world" } }, "fail_open": true, "usage_model": "standard", "ai_bindings": { "AI_BINDING": { "project_id": "some-project-id" } }, "analytics_engine_datasets": { "ANALYTICS_ENGINE_BINDING": { "dataset": "api_analytics" } }, "browsers": { "BROWSER": {} }, "d1_databases": { "D1_BINDING": { "id": "445e2955-951a-43f8-a35b-a4d0c8138f63" } }, "durable_object_namespaces": { "DO_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "hyperdrive_bindings": { "HYPERDRIVE": { "id": "a76a99bc342644deb02c38d66082262a" } }, "kv_namespaces": { "KV_BINDING": { "namespace_id": "5eb63bbbe01eeed093cb22bb8f5acdc3" } }, "limits": { "cpu_ms": 100 }, "mtls_certificates": { "MTLS": { "certificate_id": "d7cdd17c-916f-4cb7-aabe-585eb382ec4e" } }, "placement": { "mode": "smart" } } } } } ``` -------------------------------- ### Get Secret Binding Go Example Source: https://developers.cloudflare.com/api/go/resources/workers_for_platforms/subresources/dispatch/subresources/namespaces/subresources/scripts/subresources/secrets/methods/get Use this Go code to retrieve a secret binding by providing the dispatch namespace, script name, secret name, and account ID. Ensure you have the cloudflare-go SDK installed. ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/workers_for_platforms" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) secret, err := client.WorkersForPlatforms.Dispatch.Namespaces.Scripts.Secrets.Get( context.TODO(), "my-dispatch-namespace", "this-is_my_script-01", "mySecret", workers_for_platforms.DispatchNamespaceScriptSecretGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", secret) } ``` -------------------------------- ### Create Pipeline Go Example Source: https://developers.cloudflare.com/api/go/resources/pipelines/methods/create_v1 Demonstrates how to create a new pipeline using the Cloudflare Go SDK. Ensure you have the necessary API token and account ID. ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/pipelines" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Pipelines.NewV1(context.TODO(), pipelines.PipelineNewV1Params{ AccountID: cloudflare.F("0123105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("my_pipeline"), Sql: cloudflare.F("insert into sink select * from source;"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` -------------------------------- ### Get Crawl Result Go Example Source: https://developers.cloudflare.com/api/go/resources/browser_rendering/subresources/crawl/methods/get Use this Go code to retrieve the result of a specific crawl job by providing the job ID and account ID. Ensure you have the cloudflare-go SDK installed and are authenticated with an API token. ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/browser_rendering" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) crawl, err := client.BrowserRendering.Crawl.Get( context.TODO(), "x", browser_rendering.CrawlGetParams{ AccountID: cloudflare.F("account_id"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", crawl.ID) } ``` -------------------------------- ### List Organizations Go Client Example Source: https://developers.cloudflare.com/api/go/resources/user/subresources/organizations/methods/list Demonstrates how to initialize the Cloudflare client and list organizations using the Go SDK. ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/user" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) page, err := client.User.Organizations.List(context.TODO(), user.OrganizationListParams{ }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` -------------------------------- ### Start Track Recording Response Example Source: https://developers.cloudflare.com/api/node/resources/realtime_kit/subresources/recordings/methods/start_track_recording Example of a successful response when starting a track recording. It includes details about the initiated recording. ```json { "success": true, "data": { "recording": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "audio_download_url": "https://example.com", "download_url": "https://example.com", "download_url_expiry": "2019-12-27T18:11:19.117Z", "file_size": 0, "invoked_time": "2019-12-27T18:11:19.117Z", "output_file_name": "output_file_name", "session_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "started_time": "2019-12-27T18:11:19.117Z", "status": "INVOKED", "stopped_time": "2019-12-27T18:11:19.117Z", "recording_duration": 0 } } } ```