'How do I connect to the Admanager API with Javascript? [closed]

I would like to connect to the Admanager and bring my reports but I have not been successful. An example of how to do it would be helpful.



Solution 1:[1]

Admanager API has the client libraries available in Java, .NET, Python, PHP, and Ruby. Unfortunately, the API isn't available in JavaScript and hence there is no support provided for JavaScript. However, a third party has written a Node.js client library for DFP which you might want to check: https://github.com/thewizarodofoz/google-ad-manager-api

Solution 2:[2]

You can develop an app script application to create Google Ad Manager connector for Data Studio reports by using Google Ad Manager API. you can find here: https://github.com/an-nguyen2101/datastudio-connectors. I details here if some ones are interesting to develop an Ad Manager connector in Data Studio.

NOTE

  • Ad Manager API requires to use a service account for accessing
  • Review Google Data Studio document to know how can develop a connector here

PREPARING STEPS

  • In Google App Script, create a new project for your connector, and enable OAuth2 library and your manifest file will be similar this:
{
  "timeZone": "{your timezone is here}",
  "dependencies": {
    "libraries": [{
      "userSymbol": "OAuth2",
      "libraryId": "1B7FSrk5Zi6L1rSxxTDgDEUsPzlukDsi4KGuTMorsTQHhGBzBkMun4iDF",///go to library to insert this code and enable OAuth2
      "version": "38",
      "developmentMode": true
    }]
  },
  .......
}
  • Go to project properties, choose Scopes and check if your project is ready to send the external API or not because Ad Manager service is not free in Google Cloud Platform. It is correct If you can see this scope : https://www.googleapis.com/auth/script.external_request

  • Go to Google Cloud Platform, create a new project for your app script, generate a service account, create OAuth 2.0 Client ID for a web application : add "https://script.google.com" to URIs1, "https://script.google.com/macros/d/{App Script ID}/usercallback" to Authorized redirect URIs

  • Go to Google Ad Manager, add service account email to Access & authentication as an administrator.

  • Now, you are ready to develop your connector in your app script project.

  • Follow my code and let me know if you need more help.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Makaveli
Solution 2