GithubHelp home page GithubHelp logo

googleapi's Introduction

Google Cloud Logo

Google API - for Nim.

This is a gowing collection of google APIs for nim.

So far it has basic support for:

  • Bigquery
  • Compute
  • Datastore
  • Spreadsheets
  • Documents
  • Drive
  • Storage

Feel free to add new services as they are wrapped. But it might just be easier to use REST Api.

REST API

But you can always access Google API through REST. For example find the REST documniation you want like:

https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects/runQuery

There you see a url and the json to send:

POST https://datastore.googleapis.com/v1/projects/{projectId}:runQuery

Just construct your own JSON and use con.get, con.post, con.put or con.delete:

const dsRoot = "https://datastore.googleapis.com/v1"
let data = %* {
  "gqlQuery": {
    "allowLiterals": true,
    "queryString": queryString
  }
}
return await conn.post(&"{dsRoot}/projects/{projectId}:runQuery", data)

No now you can use any google library with this trick!

Service accounts

There are many ways to access google APIs but the best way is service accounts. In the end you'll end up using service accounts so might as well start now.

You can create a service account here: https://cloud.google.com/iam/docs/creating-managing-service-accounts

Then you download the JSON for your service account and load that to create a connection.

var conn = await newConnection("your_service_account.json")

Service account is like an email + public key (with with some extra JSON) that you use to access any google service.

You might run into permission issues with your service account, simply share any google project/service/dataset/page/document/sheet/table ... with the email of the service account, like as if it was a real person.

googleapi's People

Contributors

treeform avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.