News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Update User Queue Agent Presence
Tags: rest api
Jun 2, 2017 at 4:33pm   •   11 replies  •  0 likes
andy-haas

I am trying to update the dndStatus for end users if they are not in the Q. So far I have this


$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "https://platform.ringcentral.com/restapi/v1.0/account/" . $RCaccountId . "/extension/" . $callerID . "/presence");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $FINALHEADERS);
curl_setopt($curl_handle, CURLOPT_PUT, true);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, '{"dndStatus": "TakeAllCalls"}');

$buffer = curl_exec($curl_handle);



The response I get is

Fatal error: Maximum execution time of 30 seconds exceeded


Any help will be much appreciated.


Thank You

Andy


11 Answers
answered on Jun 3, 2017 at 3:47am  
On the API how do I log in as an admin. Currently when I get my token I log in as the main account which is a Super Admin already.

Thank You
Andy

 0
answered on Jun 2, 2017 at 9:58pm  
Andy, only administrator can update presence status of other users (regular users can only update their own statuses). So you has to be authenticated as an admin user with corresponding permissions to call this API.

 0
answered on Jun 2, 2017 at 7:56pm  
I am doing this through the API. I am reading this doc to do exactly what we want to do. 

If an end user is not in the Q we want to be able to programmatically edit their status.

Update User Queue Agent Presence

To enable or disable an user extension's queue agent presence, update the extension's presence dndStatus property.

http://ringcentral-api-docs.readthedocs.io/en/latest/call_queue/

Thank You
Andy

 0
answered on Jun 2, 2017 at 7:53pm  
Andy,

Please keep in mind that you cannot Update the Presence on an Extension if you are not logged in as that extension unless you are a Super Admin.


 0
answered on Jun 2, 2017 at 7:44pm  
AK,
Thank You for that.

Now missing another permission
{ "errorCode" : "CMN-408", "message" : "[EditPresenceStatus] permission required", "errors" : [ { "errorCode" : "CMN-408", "message" : "[EditPresenceStatus] permission required", "permissionName" : "EditPresenceStatus" } ], "permissionName" : "EditPresenceStatus" }{ "errorCode" : "CMN-408", "message" : "[EditPresenceStatus] permission required", "errors" : [ { "errorCode" : "CMN-408", "message" : "[EditPresenceStatus] permission required", "permissionName" : "EditPresenceStatus" } ], "permissionName" : "EditPresenceStatus" }

Thank You for Everything.
Andy


 0
answered on Jun 2, 2017 at 7:39pm  
We have added the permission on your application. Did it work?

Oh thats easy, I guess you are missing the "Content-Type: application/json" header. Could you try with the header please. 

 0
answered on Jun 2, 2017 at 7:39pm  
Still Getting an 415 Unsupported Media Type. Here is the written code


$REQUEST_BODY = '{"dndStatus":"TakeAllCalls"}';

curl_setopt_array($curl, array(
                CURLOPT_URL => " https://platform.ringcentral.com/restapi/v1.0/account/"; . $RCaccountId . "/extension/" . $callerID . "/presence",
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_MAXREDIRS => 10,
                CURLOPT_TIMEOUT => 30,
CURLOPT_SSL_VERIFYPEER => false,
                CURLOPT_CUSTOMREQUEST => "PUT",
                CURLOPT_POSTFIELDS => '{"dndStatus":"TakeAllCalls"}',
                CURLOPT_HTTPHEADER => [$REQUEST_HEADER_authorization, "Accept: application/json"]
            ));


I do now have EditPresence enabled on this project. 

Thank You
Andy


 0
answered on Jun 2, 2017 at 7:01pm  
AK,
I have emailed you the appKey. Please let me know if you need anything else.

Thank You
Andy

 0
answered on Jun 2, 2017 at 6:58pm  

Andy,


You would need to add the 'EditPresence' permission on your application in order to exercise this API endpoint.


Email the developer support team or submit a support ticket with your appKey and the necessary details and we would add the permission on your application at the earliest.


 1
answered on Jun 2, 2017 at 6:38pm  
So I updated my erroring and I don't have EditPresence

The question I have is how do I get this. I looked at creating a new app but only Edit Messages were there.

{ "errorCode" : "InsufficientPermissions", "message" : "In order to call this API endpoint, application needs to have [EditPresence] permission", "errors" : [ { "errorCode" : "CMN-401", "message" : "In order to call this API endpoint, application needs to have [EditPresence] permission", "permissionName" : "EditPresence" } ], "permissionName" : "EditPresence" }


Thank You
Andy

 0
answered on Jun 2, 2017 at 5:41pm  
Update I am now getting a 415, Unsupported attachment media type. I changed the Put statement and put it in the header. X-HTTP-Method-Override: PUT

the data that I am passing is 
$REQUEST_BODY = '{"dndStatus": "TakeAllCalls"}';

 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us