Platform

Platform

A place for Apptio product users to learn, connect, share and grow together.

 View Only
  • 1.  DataLink4 and Google Drive

    Posted 09/07/17 04:38 AM

    Hey team,

     

    Looking at setting up Datalink 4 for as many data sources as possible for our CT implementation, and our file system is mainly Google Drive.

     

    Has anyone used Google Drive with Datalink 4? Any tips, or any documentation that people have around such an implementation would be great. Have just started looking at it, but looks like Datalink should be able to use the REST API within Drive.

     

    Andrew

     

    cc: @Micah Boomer�





    #Datalink


  • 2.  Re: DataLink4 and Google Drive

    Posted 09/07/17 04:07 PM

    I have not personally tried it but the REST API does look promising. Authentication can be tricky but they support OAuth2 which again looks promising. Let Support know if you run into any issues.

     

    Ken


    #Datalink


  • 3.  Re: DataLink4 and Google Drive

    Posted 09/11/17 03:26 PM

    I have a ticket in place with respect to this. DataLink has some issues OAuth2.0 authentication while using generic REST API. When I requested for tokens, datalink embeded Client Secret along with Client ID in the request to retrieve tokens url, which Google API didn't like it and show below message.  

     

    Error: invalid_request Parameter not allowed for this message type: client_secret

     

    Thanks

    Prem


    #Datalink


  • 4.  Re: DataLink4 and Google Drive

    Posted 09/12/17 06:27 AM

    Hi Prem,

     

    I haven't had the chance to have a go yet, therefore if you do come up with a resolution please do let us know.

     

    Thanks


    #Datalink


  • 5.  Re: DataLink4 and Google Drive
    Best Answer

    Posted 11/17/17 12:15 PM

    Thought I would give an update as we have got it working.

     

    How we work is, we have a central Google Sheet that stores all our mappings which is modified by a few people. To get this to work using the Drive API, we first have a script running that copies this one file into multiple files (you will see why shortly). This script runs at night. You could also use the importrange method within each of the sheets.

     

    In Datalink we then have a separate connector for each file. Each file has a ID (which you can see in the address bar) and we are calling this file using the following REST URL (replace {SpreadsheetID} with the relevant ID:

     

    https://www.googleapis.com/drive/v3/files/{SpreadsheetID}/export 

     

    We are then exporting this file to a CSV. The Drive API only allows you to export the first tab to tsv/csv (hence why a separate file for each mapping table per above).

     

    In the 'Has Query Arguments' you need the following to convert it to a CSV:

    Key: mimeType

    Value: text/csv

     

    This appears to work fine. We are using OAUTH2

     

    Drive API Docs: Files: export  |  Drive REST API v2  |  Google Developers 

     

    The next thing we are going to try and get working is using the Google Sheets API which returns JSON. I don't think the JSON follows Apptio guidelines, so tbc.

     

    FYI, Google Sheets API: REST Resource: spreadsheets.values  |  Sheets API  |  Google Developers  

     

    Cheers


    #Datalink


  • 6.  Re: DataLink4 and Google Drive

    Posted 11/17/17 12:35 PM

    Great! You are pushing the file using Google REST API into .csv file, instead of pulling with Datalink REST api 


    #Datalink


  • 7.  Re: DataLink4 and Google Drive

    Posted 11/17/17 12:46 PM

    Correct, so we are calling the Google Drive API from Datalink, which pulls a CSV file which is created on the fly using the Drive API.

     

    Thanks


    #Datalink


  • 8.  Re: DataLink4 and Google Drive

    Posted 11/17/17 01:08 PM

    Andrew, 

    Would you mind elaborating on OAuth setup? I ran into issues with authorizing with OAuth2.0. What values did you use for Grant type and Scope?

     

    Thanks

    Prem


    #Datalink


  • 9.  Re: DataLink4 and Google Drive

    Posted 11/17/17 04:28 PM

    There are several scopes you can use, the easiest but not necessarily the most secure would be https://www.googleapis.com/auth/drive

     

    Can find the details here: About Authorization  |  Drive REST API  |  Google Developers 

     

    Before all that you will need to enable API on the Google developers Dashboard, more info here: Using OAuth 2.0 to Access Google APIs  |  Google Identity Platform  |  Google Developers 

     

    Cheers


    #Datalink