How to assign CAll Flow to a DID

I would like to use the API to assign a Call Flow to a DID. The same result as you get by manually: Admin / DID Numbers / Assign DID number

I found the PUT/api/v2/architect/ivrs/{ivrId}

{
"name": "test1",
"version": 3,
"dnis": [
"31123456789"
]
}

But running this, the new DID will be added, but all already assigned DIDs are removed, include config of this Call Flow. So can I use this API with some options to keep current config, or os there another API I can use?

Many thanks!

regards,
Co

Please, is there someone who cal help me how to just add a DID to a Call Flow without any other changes?

@copost

I'm guessing what's happening is that the other DNIs and config is getting overwritten because this a PUT and not a PATCH endpoint. You should be able to first call GET /api/v2/architect/ivrs/{ivrId}, then use the response body to fill out the rest of the request to PUT/api/v2/architect/ivrs/{ivrId}

@jacobshaw thanks for your solution (workaround) and this worked properly. However, since this is a list of 200+ DNIS numbers for one call flow ( an important one) the impact would be very large if something goes wrong and the DNIS aren't assigned anymore.
Do you know if there is another way to assign a DID to a call flow?

thanks!

That is standard practice for PUT endpoints, which are meant to replace the entire object, versus a PATCH endpoint which is meant for partial updates. An alternative would be to use GET /api/v2/architect/ivrs to get all the IVR configs up front, then stash them somewhere and then lookup and use them as needed.

Thanks again, and I know how a PUT works and I wish there was a PATCH. So I was hoping there was another API where you assigning a calls flow to a DNIS, in stead of DNIS to a CallFlow like this API.
Just like you do at the GUI. But it seems there is not.
However, thanks for your time!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.