Is it possible to set a RingCentral user's timezone through the API? - ringcentral

I was looking thru the API for how to set timezone and cannot find it. Is there not a way to set the timezone thru the API?

A user's timezone is set as part of their extension properties and is read using the Extension Info API and set via the Update Extension Info endpoint, not a specific timezone endpoint. I'll start with the read because the response provides an easy way to create the update timezone request.
Read Timezone
To read the user's current timezone, retrieve the user's settings info using the following endpoint. You will get a lot of properties. From the response, you can see how to create the update request.
GET /restapi/v1.0/account/{accountId}/extension/{extensionId}
The response will contain a lot of information including the timezone as shown. Use this JSON path in your update request with a timezone id shown later below.
{
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/11111111/extension/22222222",
"id": 22222222,
"extensionNumber": "101",
...
"regionalSettings": {
"timezone": {
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/timezone/60",
"id": "60",
"name": "Pacific/Honolulu",
"description": "Hawaii",
"bias": "-600"
},...
}
}
See more in the API Reference:
https://developer.ringcentral.com/api-reference#User-Settings-loadExtensionInfo
Set Timezone
To set a user's timezone, update the user's extension endpoint using the PUT method and specify the timezone id in the body as shown. The timezone ids can be found in the timezone endpoint shown next.
PUT /restapi/v1.0/account/{accountId}/extension/{extensionId}
{
"regionalSettings": {
"timezone": {
"id": "58"
}
}
}
https://developer.ringcentral.com/api-reference#User-Settings-updateExtension
List Timezones
To get a list of timezones, call the timezone endpoint:
GET /restapi/v1.0/dictionary/timezone
The response provides a list of timezones with description and a timezone id that is used in the update user settings request.
{
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/timezone?page=1&perPage=100",
"records": [
{
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/timezone/1",
"id": "1",
"name": "GMT",
"description": "Casablanca, Monrovia, Reykjavik",
"bias": "0"
},
{
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/timezone/2",
"id": "2",
"name": "Europe/Lisbon",
"description": "Dublin, Edinburgh, Lisbon, London",
"bias": "0"
},
...
{
"uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/timezone/91",
"id": "91",
"name": "Asia/Pyongyang",
"description": "Pyongyang",
"bias": "510"
}
],
"paging": {...},
"navigation": {...}
}
See the API Reference for more information:
https://developer.ringcentral.com/api-reference#Regional-Settings-listTimezones

Related

Callback url value in email for verifying account

This is an extension of Unable to validate account confirmation in WSO2 version 6.0 issue.
I have same regex pattern in my self-registration section. But when I'm creating users using rest API, the link which I got in the email is
https://localhost:9443/accountrecoveryendpoint/confirmregistration.do?confirmation=ce790759-1086-4870-a673-35b5927351d8&userstoredomain=PRIMARY&username=samyu&tenantdomain=carbon.super&callback={{callback}}
and when I created the user using manually the link which I got is
https://localhost:9443/accountrecoveryendpoint/confirmregistration.do?confirmation=dff024e7-d7e7-48ef-bb60-1c1c4d6f3b1c&userstoredomain=PRIMARY&username=sam&tenantdomain=carbon.super&callback=https%3A%2F%2Flocalhost%3A9443%2Fmyaccount.
So, the difference between these two links is that callback. So what configuration should I make in order to get the callback value
When you are trying this from the recovery portal, the callback value is set automatically. If you are trying with the REST API you need to include that in the request. The following is a sample JSON payload.
{
"user": {
"username": "kim",
"realm": "PRIMARY",
"password": "Password12!",
"claims": [
{
"uri": "http://wso2.org/claims/givenname",
"value": "kim"
},
{
"uri": "http://wso2.org/claims/emailaddress",
"value": "kimAndie#gmail.com"
},
{
"uri": "http://wso2.org/claims/lastname",
"value": "Anderson"
},
{
"uri": "http://wso2.org/claims/mobile",
"value": "+947729465558"
}
]
},
"properties": [
{
"key": "callback",
"value": "https://localhost:9443/myaccount"
}
]
}
Notice the way how you need to send the callback when using the REST API.

GSuite - Last email activity

I am trying to create a GSuite integration using GSuite Admin SDK that will fetch a list of users and the datetime of their last activity. I am able to fetch last login time, but I can't find a way to find the last email activity for a user that uses POP or IMAP email clients.
The data that I am trying to fetch is available in the admin console:
But is there a way to fetch it using Gsuite Admin SDK?
I found a solution to get the email activities for users, but the examples in the API reference were not so straight-forward, and they were spread out on several pages. I ended up using User Usage Report from the GSuite Reports API (as suggested in a comment on the original question): https://developers.google.com/admin-sdk/reports/v1/guides/manage-usage-users
Sample call:
GET https://www.googleapis.com/admin/reports/v1/usage/users/all/dates/2018-05-21?parameters=classroom:last_interaction_time,accounts:last_login_time,accounts:last_sso_time,gmail:last_access_time,gmail:last_imap_time,gmail:last_interaction_time,gmail:last_pop_time,gmail:last_webmail_time
This way I was able to get not only email activities, but also Classroom last interaction time and GSuite last login time and Last SSO time.
Sample user response:
"entity": {
"type": "USER",
"customerId": "customerId",
"userEmail": "sample#email.com",
"profileId": "profileId"
},
"parameters": [
{
"name": "classroom:last_interaction_time",
"datetimeValue": "1970-01-01T00:00:00.000Z"
},
{
"name": "accounts:last_login_time",
"datetimeValue": "2018-05-18T14:46:11.000Z"
},
{
"name": "accounts:last_sso_time",
"datetimeValue": "1970-01-01T00:00:00.000Z"
},
{
"name": "gmail:last_access_time",
"datetimeValue": "2018-05-18T08:43:15.000Z"
},
{
"name": "gmail:last_imap_time",
"datetimeValue": "1970-01-01T00:00:00.000Z"
},
{
"name": "gmail:last_interaction_time",
"datetimeValue": "2018-04-23T07:08:40.000Z"
},
{
"name": "gmail:last_pop_time",
"datetimeValue": "1970-01-01T00:00:00.000Z"
},
{
"name": "gmail:last_webmail_time",
"datetimeValue": "2018-04-23T07:08:44.000Z"
}
]

Delete record Libcloud (GoDaddy api)

I try to implement delete method for Record delate-record, but its my first time to use python and this api.
The GoDaddy API doesn't have a delete record method, so this functionality is not exposed in the driver.
https://developer.godaddy.com/doc#!/_v1_domains/recordReplace
The driver could offer the 'replace records in zone' method, which would allow you to fetch the current list of records, and then set the new list minus the record you want to remove. But that feature is not implemented and quite risky.
First,
Send a GET request to https://api.godaddy.com/v1/domains/{DOMAIN}/records
Then, Enumerate over all records of API Response (JSON Array) and prepare new data by removing the one that needs to be deleted.
API Response (SAMPLE)
[
{
"data": "192.168.1.1",
"name": "#",
"ttl": 600,
"type": "A"
},
{
"data": "ns1.example.com",
"name": "#",
"ttl": 3600,
"type": "NS"
},
{
"data": "#",
"name": "www",
"ttl": 3600,
"type": "CNAME"
},
{
"data": "mail.example.com",
"name": "#",
"ttl": 3600,
"priority": 1,
"type": "MX"
}
]
New Data (After deleting record) (SAMPLE)
[
{
"data": "192.168.1.1",
"name": "#",
"ttl": 600,
"type": "A"
},
{
"data": "ns1.example.com",
"name": "#",
"ttl": 3600,
"type": "NS"
},
{
"data": "#",
"name": "www",
"ttl": 3600,
"type": "CNAME"
}
]
Now,
Send a PUT request to https://api.godaddy.com/v1/domains/{DOMAIN}/records with new data.
The most important thing is how you identify the records in above array which needs to be deleted. This would not be a difficult task, assuming you have good programming skills.
I managed to worked around it in kind of a hacky - we had bunch of records we wanted to delete, doing it manually seemed weird so I added a Javascript into the Chrome Developer Console, running on an authenticated session from the DNS manage page:
function deleteGoDaddyRecords(recordId) {
$.ajax({
url: 'https://dcc.godaddy.com/api/v3/domains/<YOUR-DOMAIN.com>/records?recordId='+recordId,
type: 'DELETE',
success: function(result) {
console.log(result)
}
});
}
which let me use the same call the UI is calling when you ask to delete a record.
the only thing you need to provide is the AttributeUid which is not available with the public API, but it is in the front-end API:
https://dcc.godaddy.com/api/v2/domains/runahr.com/records
So I managed to create a script that will generate bunch of
deleteGoDaddyRecords('<RECORD-UUID>');
deleteGoDaddyRecords('<RECORD-UUID>');
copy & paste the generated script into the Developers Console and that solved it for now.
I hope GoDaddy will add a public DELETE endpoint to their API in the future :)

Oauth.io only gets "name" and "id" in the raw data from Facebook v2.4 and v2.5

When integrating a Facebook App with oauth.io, the latest API version we can choose is v2.3.
The login process works though, but, when trying to retrieve the user data (/me), only the elements name and id are being delivered in the raw data from the oauth.io response:
curl "https://oauth.io/auth/facebook/me"
-H “oauthio:k=<myOauthKey>&access_token=<fbAccessToken>"
we get following response:
{
"status": "success",
"data":
{
"id": "fbId",
"avatar": "https://graph.facebook.com/v2.3/fbId/picture",
"name": "User Name",
"gender": 1,
"url": "https://www.facebook.com/fbId",
"raw":
{
"name": "User Name",
"id": "fbId"
}
}
}
If we make the call directly using Facebook, I can get extra fields if I specify them in the URL:
curl "https://graph.facebook.com/v2.5/me?access_token=<fbAccessToken>
&fields=name,email,gender,birthday,first_name,last_name,picture"
we get the data we are looking for:
{
"name": "User Name",
"email": "email\u0040email.com",
"gender": "female",
"birthday": "03/02/1994",
"first_name": "User",
"last_name": "Name",
"picture": {
"data": {
"is_silhouette": false,
"url": "https://scontent.xx.fbcdn.net/hprofile-xlt1/v/t1.0-1/p50x50/whatever"
}
},
"id": "fbId"
}
The reason is clear: since v2.4 Facebook requires the fields parameter to retrieve the extra data. See Fewer default fields for faster performance under https://developers.facebook.com/blog/post/2015/07/08/graph-api-v2.4/
Do you know if there is any way to tell oauth.io to fill the fields parameter when calling the facebook /me call?
Btw, using:
https://oauth.io/auth/facebook/me?fields=name,email,gender,birthday
does not work.
Oauth.io has fixed the issue and is available from 1.0.0-beta.18
https://github.com/oauth-io/oauthd/commit/7beec64ab39955c3afd2eb28ecf7288c74ccdc96

Facebook graph API obtain a specific users's pictures from that same user

I'm working on an Android application and I'm trying to obtain contact pictures from friends. I'm still testing the graph request on the Facebook Graph API Explorer linkhere I'm going to use afterwards in the code, and I've hit a snag...
After generating an Access Token, and validating it allows me access to the correct fields I'm interested, I'm trying to filter the information I'm obtaining from Facebook.
Using the Facebook Graph API Explorer I'm performing the following request:
< USER_ID>?fields=id,first_name,last_name,location,picture,birthday,photos.limit(3).fields(id,picture,source,from)
I obtain, as expected:
{
"id": "<USER_ID>",
"first_name": "<FIRST>",
"last_name": "<LAST>",
"photos": {
"data": [
{
"id": "<PICTURE1>",
"source": "<PIC1.jpg>",
"from": {
"name": "<OTHER_USER1>",
"id": "<OTHER_USER1_ID>"
},
"created_time": "2013-08-17T11:39:19+0000"
},
{
"id": "<PICTURE2>",
"source": "<PIC2.jpg>",
"from": {
"name": "<OTHER_USER2>",
"id": "<OTHER_USER2_ID>"
},
"created_time": "2013-08-04T14:27:07+0000"
},
{
**"id": "<PICTURE3>"**,
"source": "<PIC3.jpg>",
"from": {
"name": "<USER>",
**"id": "<USER_ID>"**
},
"created_time": "2013-08-03T17:35:20+0000"
}
],
"paging": {
"previous": "<LINK1>",
"next": "<LINK2>"
}
},
"picture": {
"data": {
"url": "<PIC>",
"is_silhouette": false
}
}
}
What I would like is to only obtain the pictures from ... like the third picture or others, is this possible using the graph api?
Thanks for the help.
Marc
PS:
I've tried adding in the end something like &photos.data.from.id=< USER_ID>
but I till get the same data set in response.
I would like to avoid requesting more pictures and filter it programmatically, because You never know how many pictures are associated with a user that where not submitted by that user.
Not possible with the Graph API, but you can use FQL, to query for the photos of the user (not those in which he's tagged in) -
SELECT pid,src FROM photo WHERE owner = me()
Check FQL - Photo to include the required fields in the result.