A simple OCaml client for Google Services.

1 year after

Google APIs Client library for OCaml

gapi-ocaml is a simple, unofficial, OCaml client for Google Services. The library supports ClientLogin, OAuth 1.0a, and OAuth 2.0 authentication. Supported RESTful APIs:

  • Calendar APIs v3
  • Google+ API v1
  • Tasks API v1
  • APIs Discovery Service v1
  • URL Shortener API v1
  • OAuth2 API v2
  • Custom Search API v1
  • Google Analytics API v3
  • Page Speed Online API v1
  • Blogger API v2
  • Site Verification API v1
  • AdSense Management API v1.1
  • BigQuery API v2
  • Drive API v2
  • Gmail API v1

Google Data Protocol APIs (GData):

  • Google Documents List API v3 (supports Google Drive)


  • Monadic interface
  • Functional lenses to access data structures
  • Service generator (experimental): a tool for generating client libraries for APIs based on the Google API Discovery format

Building gapi-ocaml


You will need the following libraries:

This library was developed and tested on Ubuntu 12.04 LTS (64-bit).

Configuration and installation

This project provides 2 libraries:

  • gapi-ocaml: Google APIs client library
  • gapi-ocaml.gdata: Google Data Protocol client library

To build the libraries, run

$ ocaml -configure
$ ocaml -build

To install the libraries, run (as root, if your user doesn't have enough privileges)

$ ocaml -install

To build and run the tests (you will need pa_monad_custom), execute

$ ocaml -configure --enable-tests
$ ocaml -build
$ ocaml -test

See src/test/ for further details regarding the tests.

To build the examples:

$ ocaml -configure --enable-examples
$ ocaml -build

See examples/ for further details regarding the examples.

To generate the documentation, run

$ ocaml -doc

Then you can browse the HTML documentation starting from gapi-ocaml.docdir/index.html, but is not installed by default.

To uninstall anything that was previously installed, execute

$ ocaml -uninstall


See auth examples in examples/auth for some examples of how to use Google's authorization endpoints.

See examples directory to find code samples that show usage of some services.

See tools/ for a complex example of how to use functional lenses within the state monad.

See tools/ for the instructions of how to build and run the service generator utility.

Related Repositories



FUSE filesystem over Google Drive ...



Fork of [google-drive-ocamlfuse]( ...



packing google-drive-ocamlfuse ...

Top Contributors

astrada pdonadeo rgrinberg Ptival


-   v0.3.1 zip tar
-   v0.3.0 zip tar
-   v0.2.14 zip tar
-   v0.2.13 zip tar
-   v0.2.12 zip tar
-   v0.2.11 zip tar
-   v0.2.10 zip tar
-   v0.2.9 zip tar
-   v0.2.8 zip tar
-   v0.2.7 zip tar
-   v0.2.6 zip tar
-   v0.2.5 zip tar
-   v0.2.4 zip tar
-   v0.2.3 zip tar
-   v0.2.2 zip tar
-   v0.2.1 zip tar
-   v0.2 zip tar
-   v0.1.16 zip tar
-   v0.1.15 zip tar
-   v0.1.14 zip tar
-   v0.1.13 zip tar
-   v0.1.12 zip tar
-   v0.1.11 zip tar
-   v0.1.10 zip tar
-   v0.1.9 zip tar
-   v0.1.8 zip tar
-   v0.1.7 zip tar
-   v0.1.6 zip tar
-   v0.1.5 zip tar
-   v0.1.4 zip tar