Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Contacts v3 API support #468

Closed
Cyberuben opened this issue Sep 12, 2015 · 7 comments
Closed

Google Contacts v3 API support #468

Cyberuben opened this issue Sep 12, 2015 · 7 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@Cyberuben
Copy link

I have seen that this has been requested in the past (more than 1 year), but I'm wondering once again if this is something worth considering to add.

Are there any valid reasons to not add it, or has no one taken the time to look into it?

@kessiler
Copy link

Any update on this?

@sachin21jan
Copy link

I am also looking for the same. Not sure why they are not supporting Google Contacts API,

@super-cache-money
Copy link

Yeah - weird

@JustinBeckwith JustinBeckwith added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Mar 4, 2016
@jmdobry
Copy link
Contributor

jmdobry commented Mar 4, 2016

As noted on the Google Contacts API page:

Note: For read-only access to users' contacts, use the People API, which provides both contact and profile information, and does not use the older GData protocol.

Are you just looking for read-only access?

@jmdobry jmdobry added question and removed type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Mar 4, 2016
@jmdobry
Copy link
Contributor

jmdobry commented Mar 5, 2016

The Google Contacts v3 API uses an older format that is quite different from the APIs that google-api-nodejs-client supports, hence why google-api-nodejs-client does not support the Contacts API.

@jmdobry
Copy link
Contributor

jmdobry commented Mar 5, 2016

Closing as this does not appear to be an issue. If you are convinced that this is really a bug, please feel free to re-open the issue and add more information such as:

  • Expected behavior
  • Actual behavior
  • Code samples
  • Version numbers
  • References docs or other links

Or, consider opening a Pull Request.

Otherwise, support questions are handled on Stack Overflow. Ask a question on Stackoverflow

@jmdobry jmdobry closed this as completed Mar 5, 2016
@abdabsi
Copy link

abdabsi commented Jul 18, 2019

The official googleapi library on NodeJS does not use GData protocol, but you can still leverage an existing Auth Client you've created with googleapi and make an HTTP request to get the Contacts API data without using another library.
Here's the code:

const {google} = require("googleapis");
const authObj = new google.auth.OAuth2({
    access_type: 'offline',
    clientId: process.env.GOOGLE_ID,
    clientSecret: process.env.GOOGLE_SECRET,
});

This is to refresh the tokens and set the new tokens to auth object:

authObj.on('tokens', (tokens) => {
    const access_token = tokens.access_token
    if (tokens.refresh_token){
        this.myTokens.refreshToken = tokens.refresh_token
        // save refresh token in the database if it exists
    }
        this.myTokens.accessToken = tokens.access_token       
        // save new access token (tokens.access_token)
}
authObj.setCredentials({
    access_token:this.myTokens.accessToken,
    refresh_token:this.myTokens.refreshToken,
});

That's the request call you need to make to access Google Contacts API v3 if you're using the googleapi nodejs library:

authObj.request({
    headers:{
        "GData-Version":3.0
    },
    params:{
        "alt":"json",
        //"q":"OPTIONAL SEARCH QUERY",
        //"startindex":0
        "orderby":"lastmodified",
        "sortorder":"descending",
    },
    url: "https://www.google.com/m8/feeds/contacts/default/full"
}).then( response => {
    console.log(response); // extracted contacts
});

@yoshi-automation yoshi-automation added 🚨 This issue needs some love. triage me I really want to be triaged. labels Apr 6, 2020
yoshi-automation added a commit that referenced this issue Apr 7, 2020
googleapis/synthtool@1df68ed
commit 1df68ed6735ddce6797d0f83641a731c3c3f75b4
Author: Alexander Fenster <fenster@google.com>
Date:   Mon Apr 6 16:17:34 2020 -0700

    fix: apache license URL (#468)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

8 participants