Skip to main content

sites

Creates, updates, deletes, gets or lists a sites resource.

Overview​

Namesites
TypeResource
Idcloudflare.magic_transit.sites

Fields​

The following fields are returned by SELECT queries:

Site Details response

NameDatatypeDescription
idstringIdentifier (example: 023e105f4ecef8ad9ca31a8372d0c353)
namestringThe name of the site. (example: site_1)
connector_idstringMagic Connector identifier tag. (example: ac60d3d0435248289d446cedd870bcf4)
secondary_connector_idstringMagic Connector identifier tag. Used when high availability mode is on. (example: 8d67040d3835dbcf46ce29da440dc482)
descriptionstring
ha_modebooleanSite high availability mode. If set to true, the site can have two connectors and runs in high availability mode.
locationobjectLocation of site in latitude and longitude.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectsite_id, account_idx-magic-new-hc-targetGet a specific Site.
listselectaccount_idconnectoridLists Sites associated with an account. Use connectorid query param to return sites where connectorid matches either site.ConnectorID or site.SecondaryConnectorID.
createinsertaccount_id, nameCreates a new Site
editupdatesite_id, account_idPatch a specific Site.
updatereplacesite_id, account_idUpdate a specific Site.
deletedeletesite_id, account_idRemove a specific Site.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
site_idstringThe site ID.
connectoridstring
x-magic-new-hc-targetbooleanIf true, the health check target in the response body will be presented using the new object format. Defaults to false.

SELECT examples​

Get a specific Site.

SELECT
id,
name,
connector_id,
secondary_connector_id,
description,
ha_mode,
location
FROM cloudflare.magic_transit.sites
WHERE site_id = '{{ site_id }}' -- required
AND account_id = '{{ account_id }}' -- required
AND x-magic-new-hc-target = '{{ x-magic-new-hc-target }}'
;

INSERT examples​

Creates a new Site

INSERT INTO cloudflare.magic_transit.sites (
connector_id,
description,
ha_mode,
location,
name,
secondary_connector_id,
account_id
)
SELECT
'{{ connector_id }}',
'{{ description }}',
{{ ha_mode }},
'{{ location }}',
'{{ name }}' /* required */,
'{{ secondary_connector_id }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

UPDATE examples​

Patch a specific Site.

UPDATE cloudflare.magic_transit.sites
SET
connector_id = '{{ connector_id }}',
description = '{{ description }}',
location = '{{ location }}',
name = '{{ name }}',
secondary_connector_id = '{{ secondary_connector_id }}'
WHERE
site_id = '{{ site_id }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;

REPLACE examples​

Update a specific Site.

REPLACE cloudflare.magic_transit.sites
SET
connector_id = '{{ connector_id }}',
description = '{{ description }}',
location = '{{ location }}',
name = '{{ name }}',
secondary_connector_id = '{{ secondary_connector_id }}'
WHERE
site_id = '{{ site_id }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples​

Remove a specific Site.

DELETE FROM cloudflare.magic_transit.sites
WHERE site_id = '{{ site_id }}' --required
AND account_id = '{{ account_id }}' --required
;