DataHub allows developers to connect client devices to datahub, create and delete accounts, and manipulate data on a user's behalf.
DataHub API applications allow...
- end users to authorize an application to view and edit their data
- developers to view and edit data in authorized DataHub accounts
For example, a user, grad_student
has a datahub account. In this case, they want to authorize the living_lab
app to view and edit data in their genome_data
repository.
Navigate to developer/apps in your DataHub installation to create a new app.
End users must authorize your application by visiting permissions/apps/allow_access/APP_ID/REPO_NAME in their browser
Note: Make sure not to commit the App Name or App ID in any public repositories!
DataHub uses Apache Thrift to generate native code for your datahub client. You will need to do this before connecting to user accounts. You can generate native code using the commands below.
cd src/examples/cpp
source setup.sh
# add credentials to SampleClient.cpp
./SampleClient.cpp
cd src/examples/java
source setup.sh
cd src
# add credentials to SampleClient.java and SampleAccount.java
cd ..
java SampleClient
java SampleAccount
cd src/examples/python
source setup.sh
mv gen-py gen_py
# addCredentials to SampleClient.py and SampleAccount.py
python SampleClient.py
python SampleAccount.py
cd src/examples/go
source setup.sh
go run SampleClient.go
cd src/examples/javascript
- open
SampleClient.html
in a browser
cd src/examples/objc
open DataHub-Example
# add credentials to main.m
- run
- not: when integrating thrift, in Build Settings:
- Always Search User Path:
YES
- Framework Search Paths: add
$(SRCROOT)
and$(inherited)
It is possible to connect to a user's account (without using their password) after they have authorized an application.
In order to follow these steps, you will have needed to create an application, which your end user(s) will need to authorize. See :ref:`app-api-intro`.
See the src/examples/language/SampleAccount.*ext* for examples.
It is possible to connect to a user's account without using an application. In this case, you will need their username and password.
Connections made using a username and password are unable to create or delete accounts.
See the src/examples/language/SampleClient.*ext* for examples.