Adding a Contact to Gmail Contact

420 views
Skip to first unread message

J.M.

unread,
Jun 30, 2015, 5:19:31 AM6/30/15
to suppor...@runmyprocess.com
Hi,

I'm trying to add a Google Contact to my account and I'm getting always the same result:

Unauthorized (401) - Unauthorized (1 attempt)

I have enabled the Contacts API on Google Console, and I have authorized it using the scope https://www.google.com/m8/feeds, and following a similar way which made work the Calendar API.

I'm using the 'Add a Contact' connector from the 'Google Contact (Gmail)' Provider.

The input variables I'm using are:

content:
<atom:title type='text'>Pepe</atom:title>
<atom:content type='text'>Notes</atom:content>
<gd:email rel='http://schemas.google.com/g/2005#work' address='pe...@gmail.com' />
<gd:phoneNumber rel='http://schemas.google.com/g/2005#work' primary='true'>654545454</gd:phoneNumber>

mail:
javiermm...@gmail.com

auth:
4/P0[...]6k
This authorization code is the result of a request to the URL:

https://accounts.google.com/o/oauth2/auth?response_type=code&scope=https%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds&access_type=offline&redirect_uri=https%3A%2F%2Flive.runmyprocess.com%2Flive%2F117241425975434943%2Fappli%2F177791%3FP_mode%3DTEST%26P_version%3D&approval_prompt=force&state=security_token%3DVj[...]s&client_id=4[...].googleusercontent.com&hl=es&from_login=1&as=15616a1825f40b9a&authuser=0


Why Am I getting the Unauthorized error?

Thanks in advance and regards.

Pankaj Kumar

unread,
Jul 1, 2015, 3:25:06 AM7/1/15
to suppor...@runmyprocess.com, Javier Martín
Hi,

It seems its related to the Oauth 2.0 authentication. Please refer to the following steps of the Oauth

  1. When you create your application, you register it with Google. Google then provides information you'll need later, such as a client ID and a client secret.
  2. Activate the Google Contacts API in the Services pane of the Google APIs Console. (If it isn't listed in the Console, then skip this step.)
  3. When your application needs access to user data, it asks Google for a particular scope of access.
  4. Google displays an OAuth dialog to the user, asking them to authorize your application to request some of their data.
  5. If the user approves, then Google gives your application a short-lived access token.
  6. Your application requests user data, attaching the access token to the request.
  7. If Google determines that your request and the token are valid, it returns the requested data.
Kindly check if the steps 3, 4, 5 running fine.

Also For adding a contact, please create a new connector according to the "Google API version 3.0",  Kindly refer to the below links for the create contact request details:-


Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support


--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at http://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/14a2d095-55e2-49c8-a9da-0decb4c8d1a6%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.

J.M.

unread,
Jul 2, 2015, 3:20:56 AM7/2/15
to suppor...@runmyprocess.com, javiermm...@gmail.com
Hi again,

I've solved the problem. I think the instruction are not too clear, however I have got to add a contact following the calendar steps (first auth_code, second refresh_token, third acces_token, forth connector to add contact).

However I'm losing some information between my connector and the final contact added. I'm sending the following information in the connector (wich is the google doc example to create a Contact without some fields):

<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
xmlns:gd='http://schemas.google.com/g/2005'>
<atom:category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/contact/2008#contact'/>
<gd:name>
<gd:givenName>${name}</gd:givenName>
<gd:familyName>${familyName}</gd:familyName>
<gd:fullName>${fullName}</gd:fullName>
</gd:name>
<atom:content type='text'>${notes}</atom:content>
primary='true'
address='${mail_adress_work}' displayName='${display_name}'/>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#work'
primary='true'>
${phone_number_work}
</gd:phoneNumber>
</atom:entry>


But the response is:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gContact="http://schemas.google.com/contact/2008" xmlns:gd="http://schemas.google.com/g/2005">
<id>http://www.google.com/m8/feeds/contacts/javiermmm.fujitsu%40gmail.com/base/31f3049c8f5fa647</id>
<updated>2015-07-02T07:12:42.906Z</updated>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#contact"/>
<title type="text"/>
<content type="text">some notes</content>
<link rel="http://schemas.google.com/contacts/2008/rel#edit-photo" type="image/*" href="https://www.google.com/m8/feeds/photos/media/javiermmm.fujitsu%40gmail.com/31f3049c8f5fa647/1B2M2Y8AsgTpgAmY7PhCfg"/>
<link rel="self" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/javiermmm.fujitsu%40gmail.com/full/31f3049c8f5fa647"/>
<link rel="edit" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/javiermmm.fujitsu%40gmail.com/full/31f3049c8f5fa647/1435821162906001"/>
<gd:email rel="http://schemas.google.com/g/2005#work" address="some...@another.com" primary="true"/>
<gd:phoneNumber rel="http://schemas.google.com/g/2005#work" primary="true" uri="tel:+34-669-82-54-71">
669825471
</gd:phoneNumber>
</entry>

So, I'm missing de 'DisplayName' of the mail address, and the name of the contact (full name, family name, full name)

Why is this happening?

Pankaj Kumar

unread,
Jul 6, 2015, 2:09:17 AM7/6/15
to suppor...@runmyprocess.com, Javier Martín
Hi Javier,

One possibility can be, missing of  "GData-Version: 3.0" in request header, you can specify it simply specify it as query parameter "v=3.0".

I am able to reproduce this issue if this parameter is missing in the request.

I use the below xml in the request, and its working fine.

<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
  <atom:category scheme='http://schemas.google.com/g/2005#kind'
  <gd:name>
     <gd:givenName>${name}</gd:givenName>
     <gd:familyName>${familyName}</gd:familyName>
     <gd:fullName>${fullName}</gd:fullName>
  </gd:name>
  <atom:content type='text'>${notes}</atom:content>
    primary='true'
    address='${mail_adress_work}' displayName='${display_name}'/>
    address='${mail_adress_home}'/>
  <gd:phoneNumber rel='http://schemas.google.com/g/2005#work'
    primary='true'>
    ${phone_number_work} 
  </gd:phoneNumber>
  <gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>
    ${phone_number_home}
  </gd:phoneNumber>
   <gd:im address='${mail_id_im}'
    primary='true'
<gd:structuredPostalAddress
      primary='true'>
    <gd:city>${city}</gd:city>
    <gd:street>${street}</gd:street>
    <gd:region>${region}</gd:region>
    <gd:postcode>${postcode}</gd:postcode>
    <gd:country>${country}</gd:country>
    <gd:formattedAddress>
      ${formattedAddress}
    </gd:formattedAddress>
  </gd:structuredPostalAddress>
 </atom:entry>

Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support

J.M.

unread,
Jul 6, 2015, 3:06:01 AM7/6/15
to suppor...@runmyprocess.com, javiermm...@gmail.com
Hi Pankaj,

With the v3 parameter the contact doesn't lose the name but the DisplayName doesn't appear anywhere. Are you seeing it? Maybe I'm looking for it in the wrong place, where should the displayName be displayed?

Besides, If I add the contact without the v3 param, the contact is added to the 'My Contacts' group by default, however if I add the contact with v3, the contact is added to 'Other Contacts'.

Is there any way to add the contact with the v3 version, directly to the 'My contacts' group, without using another connector for this purpose?


Thanks and regards.

Pankaj Kumar

unread,
Jul 7, 2015, 5:24:34 AM7/7/15
to suppor...@runmyprocess.com, Javier Martín
Hi Javier,

I am working/exploring the Google Contact API, will update you soon on this.

Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support

javiermm...@gmail.com

unread,
Jul 28, 2015, 5:22:49 AM7/28/15
to Fujitsu RunMyProcess Developer Community, pku...@runmyprocess.com
Hi Pankaj,

No results yet?
I'm still interested in how to add a contact having his name and adding it to the 'my contacts' group (instead of 'other contacts')

Thanks and regards.

Pankaj Kumar

unread,
Jul 28, 2015, 6:24:55 AM7/28/15
to Javier Martín, Fujitsu RunMyProcess Developer Community
Hi Javier,

Google Contact API is maintained by Google, I have raise this query on "Google Contact Support Forum" on "stackoverflow.com" with the necessary tag,


Requesting you to follow this post for the query.

Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support
Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support

Reply all
Reply to author
Forward
0 new messages