question

spring-it avatar image
spring-it asked ·

Weird "Boundary" in presence response when requesting for multiple extensions

When requesting presence information for multiple extensions ( https://platform.ringcentral.com/restapi/v1.0/account/~/extension/1868975015,1943182015,etc...), I get a weird "boundary" in the response that is messing everything up.

--Boundary_3591_2052943368_1481849425687
Content-Type: application/json { "response" : [ { "href" : "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/1868975015/presence";, "status" : 200, "responseDescription" : "OK" }, { "href" : "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/1943182015/presence";, "status" : 200, "responseDescription" : "OK" } ] } --Boundary_3591_2052943368_1481849425687 Content-Type: application/json { "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/1868975015/presence";, "extension" : { "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/1868975015";, "id" : 1868975015, "extensionNumber" : "101" }, "presenceStatus" : "Available", "telephonyStatus" : "NoCall", "userStatus" : "Available", "dndStatus" : "TakeAllCalls" } --Boundary_3591_2052943368_1481849425687 Content-Type: application/json { "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/1943182015/presence";, "extension" : { "uri" : "https://platform.ringcentral.com/restapi/v1.0/account/~/extension/1943182015";, "id" : 1943182015, "extensionNumber" : "10732" }, "presenceStatus" : "Offline" } --Boundary_3591_2052943368_1481849425687

This appears to be a bug, and should be fixed. It would be really nice to be able to pull the 30 extension presences at a time, since the bulk presence request ( https://platform.ringcentral.com/restapi/v1.0/account/~/presence?page=1&perPage=1000) does not work. See https://devcommunity.ringcentral.com/ringcentraldev/topics/requesting-presence-for-all-extensions-al... for more information. If this is a "feature", could I get some explanation as why it exists?

Thanks!
topic-default
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tyler Liu avatar image
Tyler Liu answered ·
It's indeed a feature and standard. It's the multipart/mixed content type.

https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html
Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

anton-nikitin avatar image
anton-nikitin answered ·
Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Simon Fallai avatar image
Simon Fallai answered ·

Why on earth would you have decided on this design decision? Here's a real-life example on why multipart output is a bad idea:

The message-store API call allows for multiple IDs to be passed, great! That way I can check the status for a bunch of faxes in one go, and not worry about the rate limit.

However, if I use the .NET SDK, the call to MessageStore("string of ids") throws an error, because it isn't valid JSON being returned. Your own SDK does not work with a function of your API because of this dumb design decision. So I can either loop through each message ID (wasteful) or roll my own HttpClient code to parse this nonsense.

You should be returning an array of MessageStore objects, not individual ones separated by essentially nonsense.

Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.