Forum Discussion

BrianT's avatar
BrianT
Icon for Joining the Conversation rankJoining the Conversation
10 months ago

addSocketSite Location lookup incomplete

Trying to add sites to tenant via API

Using addSocketSite in Postman.

Fails, reporting: {"errors":[{"message":"timezone [US/Pacific] is unknown","path":["site","addSocketSite","input","siteLocation","timezone"]}],"data":{"site":{"addSocketSite":null}}}

Inspecting the results of the lookup, I can see that UA has three timezones

When you lookup US there is only one timezone.

If I am importing 15 sites only the sites in Mountain timezone succeed.

 

Is this a production tool or method?

1 Reply

  • Hi,

    The topic of resolving the siteLocation has been something we have been working to make more simple, as using the apis directly can be a bit cumbersome to get the specific data you are looking for all in one payload.  There are a few ways we can address that in a more simple way.

    1. use the catocli (public pip package) to run a single command to resolve these fields.
      Example in a terminal:
      $ pip3 install catocli
      $ export CATO_TOKEN="your-api-token-here"
      $ export CATO_ACCOUNT_ID="your-account-id"
      $ catocli query siteLocation -h
      $ catocli query siteLocation '{"filters":[{"search": "San Diego","field":"city","operation":"exact"}]}' -p
    2. Use a terraform data source
      https://registry.terraform.io/providers/catonetworks/cato/latest/docs/data-sources/siteLocation
    3. Ingest the json data directly in your code as a local lookup
      https://github.com/catonetworks/cato-cli/blob/main/models/query.siteLocation.json