Chris_Carr | 2022-06-16 21:14:54 UTC | #1
Hello,
I am trying to update an IVR's config using body = PureCloudPlatformClientV2.IVR() and was wondering how include the json body using body = PureCloudPlatformClientV2.IVR(). I normally just create a JSON body but wanted to know how I could use this method.
Code snippet:
apiinstance = PureCloudPlatformClientV2.ArchitectApi() ivrid = 'ivridexample' # str | IVR id body = PureCloudPlatformClientV2.IVR() # IVR |
try:
Update an IVR Config.
apiresponse = apiinstance.putarchitectivr(ivrid, body) pprint(apiresponse) except ApiException as e: print("Exception when calling PutArchitectIvrRequest->putarchitectivr: %s\n" % e)
Thanks.
charlie.conneely | 2022-06-17 14:16:51 UTC | #2
Hi Chris,
If you want to update an existing IVR, instantiating a variable with PureCloudPlatformClientV2.IVR() won't do, as you are creating a new IVR object. This would be more appropriate for a POST operation. I believe what you should do is perform a GET request using the IVR ID and change fields on the response body which, if successful, will be the IVR config. I've attached an example below.
try:
body = architectApi.get_architect_ivr(ivrId)
body.description = 'Updated description'
try:
api_response = architectApi.put_architect_ivr(ivrId, body)
pprint(api_response)
except ApiException as e:
print("Exception when calling PutArchitectIvrRequest->put_architect_ivr: %s\n" % e)
except ApiException as e:
print("Exception when calling GetArchitectIvrRequest->get_architect_ivr: %s\n" % e)
Please let me know if this answers your question.
Kind regards, Charlie
Chris_Carr | 2022-06-17 14:17:51 UTC | #3
Thank you, I will give this a go, appreciate it.
Kind Regards, Chris
system | 2022-07-18 14:18:27 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 15195