Skip to content
Start here

List locations

client.Radar.Entities.Locations.List(ctx, query) (*EntityLocationListResponse, error)
GET/radar/entities/locations

Retrieves a list of locations.

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)
User Details WriteUser Details Read
ParametersExpand Collapse
query EntityLocationListParams
Continent param.Field[EntityLocationListParamsContinent]Optional

Filters results by continent code.

const EntityLocationListParamsContinentAf EntityLocationListParamsContinent = "AF"
const EntityLocationListParamsContinentAs EntityLocationListParamsContinent = "AS"
const EntityLocationListParamsContinentEu EntityLocationListParamsContinent = "EU"
const EntityLocationListParamsContinentNa EntityLocationListParamsContinent = "NA"
const EntityLocationListParamsContinentOc EntityLocationListParamsContinent = "OC"
const EntityLocationListParamsContinentSa EntityLocationListParamsContinent = "SA"
Format param.Field[EntityLocationListParamsFormat]Optional

Format in which results will be returned.

const EntityLocationListParamsFormatJson EntityLocationListParamsFormat = "JSON"
const EntityLocationListParamsFormatCsv EntityLocationListParamsFormat = "CSV"
Limit param.Field[int64]Optional

Limits the number of objects returned in the response.

exclusiveMinimum
minimum0
Location param.Field[string]Optional

Filters results by location. Specify a comma-separated list of alpha-2 location codes.

Offset param.Field[int64]Optional

Skips the specified number of objects before fetching the results.

minimum0
Region param.Field[string]Optional

Filters results by region.

maxLength100
Subregion param.Field[string]Optional

Filters results by subregion.

maxLength100
ReturnsExpand Collapse
type EntityLocationListResponse struct{…}
Locations []EntityLocationListResponseLocation
Alpha2 string
Continent string
Latitude string

A numeric string.

Longitude string

A numeric string.

Name string
Region string
Subregion string

List locations

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/cloudflare-go"
  "github.com/stainless-sdks/cloudflare-go/option"
  "github.com/stainless-sdks/cloudflare-go/radar"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  locations, err := client.Radar.Entities.Locations.List(context.TODO(), radar.EntityLocationListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", locations.Locations)
}
{
  "result": {
    "locations": [
      {
        "alpha2": "AF",
        "continent": "AS",
        "latitude": "10",
        "longitude": "10",
        "name": "Afghanistan",
        "region": "Middle East",
        "subregion": "Southern Asia"
      }
    ]
  },
  "success": true
}
Returns Examples
{
  "result": {
    "locations": [
      {
        "alpha2": "AF",
        "continent": "AS",
        "latitude": "10",
        "longitude": "10",
        "name": "Afghanistan",
        "region": "Middle East",
        "subregion": "Southern Asia"
      }
    ]
  },
  "success": true
}