Google API - How can I get the gmail contact details page? - google-api

My application use google+ sign-up and login system.
When user click on gplus button allows my app to manage his gmail contacts.
After logged in, I can get all the gmail contacts very easily with a simple $.getJSON call.
Google response is a well structured JSON - feed and entries where I can find contacts fullname, email address, mobile number etc.
My problem is to be able to jump to the google details page of a specific contact.
Here my question: Do you know how can I do that?
I mean ... where is the contact unique identifier and how can I make a link that open the google details of that specific contact?
Thanks

Use Google+ data API instead. It returns with details of use including id of that user.
Its response is as below:
{
"kind": "plus#person",
"id": "118051310819094153327",
"displayName": "Chirag Shah",
"url": "https://plus.google.com/118051310819094153327",
"image": {
"url": "https://lh5.googleusercontent.com/-XnZDEoiF09Y/AAAAAAAAAAI/AAAAAAAAYCI/7fow4a2UTMU/photo.jpg"
}
}
Now, using that id, you can goto user details page at http://plus.google.com/your_id
for full details, see here: https://developers.google.com/+/api/#data

Related

Add Google Chat App to a space using REST API

I have a Google Chat App (running an App Script) that needs to add itself to a Google Space.
According to the documentation Docs
a chat app can add itself to a space. (I've already joined the Developer Preview Program).
The problem is that the API's response is always 403 with message 'Caller must be a human user with a Google Workspace account with access to Google Chat.'.
Why the caller has to be a human user if the documentation clearly says that a chat app can add itself to a space?
Currently, my app makes a request to the following endpoint:
POST https://chat.googleapis.com/v1/spaces/XXXXX/members
with the following body:
{ "member": { "name": "users/app", "domainId": "company.it", "type": "BOT" } }
The access token is retrieved using a Service Account (the same as the chat app)

Why does it turn into an unavailable room when I create a google resource calendar with its API?

I'm going to create a google resource calendar room via its API (i.e. https://admin.googleapis.com/admin/directory/v1/customer/my_customer/resources/calendars). But the problem is, when I create one, it turns into an unavailable (crossed out) room within google calendar rooms and I couldn't find any attribute to make it available!
Here's the body request/response:
{
"kind": "admin#directory#resources#calendars#CalendarResource",
"etags": "\"CTyc505ppdmJR2motHVsU17kzItOkPo5vYViqlSF0rU/FB0b765ZgWIpTBaxn5YQIwZWWNM\"",
"resourceId": "9f698cdc-84f9-4688-95a7-c2207b4fa7ae",
"resourceName": "StackOverflow Test",
"generatedResourceName": "Orangery Hildesheim Nordstadt-EG-StackOverflow Test (3)",
"resourceEmail": "c_1881d77mmcaqsihgi426fseae6vnc#resource.calendar.google.com",
"capacity": 3,
"buildingId": "Orangery-Hildesheim-Nordstadt",
"floorName": "EG",
"resourceCategory": "CONFERENCE_ROOM"
}
Here's the output on google calendar:
After two months finally I found a solution!
In fact, the main problem is related to the lack of permission for those created resources for other users in the organization. To tackle this problem I used another google API named ACL (Access Control Level) ref, to set a privilege for other users. Basically, a google resource actually is a google resource calendar, so you can use ACL API to access that calendar. Moreover, the parameter to reach that calendar is resourceEmail as the unique ID of the respective resource calendar.
Here's the thing I did to make unavailable resources to be available (bookable):
POST https://www.googleapis.com/calendar/v3/calendars/calendarId/acl
change calendarId with the value of resourceEmail of the google resource.
the body of the request:
{
"scope": {
"type": "domain",
"value": "orangery.io" # if you selected type as `domain` you should write your domain name here.
},
"role": "writer"
}
[NOTE]:
With this procedure, you will need to the https://www.googleapis.com/auth/calendar authorization scope as well.

How can I get the user's first and last name by his gmail?

I am developing an application to work admin.google.com. In my application through Google_Service_Directory I got a users. But I can not understand who it is - I see only gmail. I want by gmail to get the name and surname. How can I do it?
On the Internet, I found answers to the Google Plus library. But Google Plus is closing. What are some other ways to get your first and last name by gmail?
You have a few options and they will give you similar information.
people get Google+ api.
Request:
GET https://www.googleapis.com/plus/v1/people/me
response: people.resource
"objectType": "person",
"id": "11720047553265346",
"displayName": "Linda Lawton",
"name": {
"familyName": "Lawton",
"givenName": "Linda"
Note: this call appears on the Google+ api documentation how ever this end point is not being shutdown. (waiting for feed back from google on if this is shut down or not.)
Userinfo endpoint
The second option is to call the identity server directly to the userinfo endpoint as described in OpenIDConnect requires profile scope i think
people.get people api
people.get from the people api
request
GET https://people.googleapis.com/v1/people/me?personfield=names
response
"displayName": "Linda Lawton",
"familyName": "Lawton",
"givenName": "Linda",
"displayNameLastFirst": "Lawton, Linda"
Cant search on email
Note: This will give you the information on the current logged in user. There is no way to get back the name of a persona directly by their email address. Assuming you are running an service account with domain wide delegation you may be able to use people.get with the user id of one of the users on the domain. I have not tried this

Zoho API: Get the user that is making the request

I have seen Zoho APIs give us the option to get all kinds of user information, yet I cannot find any method to fetch info about the user that is currently making the request.
OAuth2 secured API's usually offer such an endpoint, like Google or Twitter do.
In their documentation there is something that looks like it:
https://www.zohoapis.com/crm/v2/users?type=CurrentUser
But then they shatter any hope with their explanation:
CurrentUser - To get the list of current CRM users
Is there any known way achieve this?
This is the right endpoint: https://accounts.zoho.com/oauth/user/info
It requires the aaaserver.profile.READ scope.
Example Response:
{
"ZUID": 123123123123,
"First_Name": "Example",
"Last_Name": "Name",
"Display_Name": "Example Name",
"Email": "example#email.com"
}
I have tested this personally and can confirm that the text on their docs is wrong.
They say:
CurrentUser - To get the list of current CRM users
But in reality, that endpoint really does return a single user everytime, the user to whom the oauth token belongs. So it's not returning "a list of current CRM users", but rather "the currently logged in user" - exactly as you desire.
So your gut was right, and that endpoint will achieve what you are trying to do.

How can I start a conversation with user data like user name, user domain ID

I need to develop enhancements to an existing app which will interact with a bot developed using MS bot framework. For this, I am thinking of utilising the Direct Channel. However, I dont understand, how I can pass on user specific information from the app to the bot.
In documentation available at https://learn.microsoft.com/en-us/bot-framework/rest-api/bot-framework-rest-direct-line-3-0-send-activity,
It is mentioned that the payload of the REST request would be
{
"type": "message",
"from": {
"id": "user1"
},
"text": "hello"
}
Where should I pass on the user specific or sessions information like user first name, last name, email id or Login id or initiating app or location from where the user is initiating the chat or anything else here ?
Any guidance will help.
How can I start a conversation with user data like user name, user domain ID
As NicolasR pointed, it does not enable us to attach/specify user information when starting a conversation on Direct Line Channel.
how I can pass on user specific information from the app to the bot
If you’d like to send activity and pass user information (firstname, lastname etc) to your bot by using the Direct Line API, as you see in that documentation, to send an activity to the bot, the client must create an Activity object to define the activity. You can refer to the following example request to contains the user information in from field of your request JSON payload.
In my bot app code (c#), I can extract user information from Activity object using the following code snippet.
if (activity.From.Properties["firstname"] != null)
{
var fname = activity.From.Properties["firstname"].ToString();
}

Resources