question

andy-haas5702 avatar image
andy-haas5702 asked ·

Update User Queue Agent Presence

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

aaa
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.

andy-haas5702 avatar image
andy-haas5702 answered ·
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"}';
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.

andy-haas5702 avatar image
andy-haas5702 answered ·
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
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.

ak avatar image
ak answered ·
Andy,

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

Email us at devsupport@ringcentral.com with your appKey and the necessary details and we would add the permission on your application at the earliest.
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.

andy-haas5702 avatar image
andy-haas5702 answered ·
AK,
I have emailed you the appKey. Please let me know if you need anything else.

Thank You
Andy
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.

andy-haas5702 avatar image
andy-haas5702 answered ·
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

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.

ak avatar image
ak answered ·
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. 
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.

andy-haas5702 avatar image
andy-haas5702 answered ·
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

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.

ak avatar image
ak answered ·
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.

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.

andy-haas5702 avatar image
andy-haas5702 answered ·
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
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 ·
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.
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.