Zoom Phone API to Forward Calls During Lunch

We are coming from a traditional PBX where we could just forward calls to an answering service ad hoc. this seems to not be supported in Zoom, so I thought why not write some python to forward and unforward, but it seems to not be working. What I would like to do is set the Main Auto Receptionist to forward to an external number when run. This is the snippet I have that is returning a 400 response code:

access_token = response.json()[“access_token”]
headers = {‘Host’:‘api.zoom.us’,‘Authorization’: “Bearer {}”.format(access_token),‘content-type’: ‘application/json’}

data = {“sub_setting_type”:“call_handling”,“settings”:{‘routing’:{‘action’: 10,‘forward_to’:{‘phone_number’: ‘+1650xxxxxxx’}}}}

response = requests.patch(“https://api.zoom.us/v2/phone/extension/{extension_id}}/call_handling/settings/business_hours”, headers=headers, data=json.dumps(data))

print(response)

I would think this would work based on the API documention and the changes I observed when changing in the web ui and using the get function.

Thanks in advance!

HI @paloaltoperio
Thanks for reaching out to us!
So what response are you getting after sending this patch request?
Are you just making one API call to patch an extension ID?

Yes, just one call. It gives Response 400.

Thanks!

Let me try and replicate this on my end and I will get back to you
Cheers,
Elisa

Hi @paloaltoperio
As I am trying to replicate this issue on my end, I am facing a couple of issues.
Are you using this endpoint here?

If so, please make sure to pass all the query parameters that are indicated, it looks like you are not passing the /call_handling/settings/{settingType}

If you are not using this endpoint, could you point me to the endpoint you are using?

Also, how are you getting the extensionID? Via API? If so, could you also share that endpoint with me please