Contains a simple client in typescript to access the RNV Open Data API and a curl script with equivalent functionality.
This readme file contains information about using the client. For detailed documentation on how to use the GraphQL interface, see the documentation link from here
To get access to our Open Data Hub API with your solutions, it is necessary to have an oauth2 access token. You need to go through several steps to generate such a token.
- You register with your name and email for "Graphql" access here. Open RNV Formular.
- After about 10 minutes you should receive a mail with your basic credentials, it's recommended to save the mail.
- From these credentials you can generate an access token for your coded clients, there are several ways to obtain such a token, some of them are described here.
- Download the graphql.http file to this repo and place it in the root path.
- Download the preparation script from gist (see below).
- Run the shell script
./prepare_env_file.sh
. This will generate a .env file which is read by the node.js application.
You can copy the shell-script from node_modules.
curl https://gist.githubusercontent.com/rnv-opendata/8365b1317505a80359491c2124a05e94/raw/2fc73bdbb1dd4872feff7aa8182c477d01a379cc/prepare_env_file.sh > prepare_env_file.sh
sudo chmod u+rwx prepare_env_file.sh
./prepare_env_file.sh > ./node/.env
$ cd node
$ curl https://gist.githubusercontent.com/rnv-opendata/900d43affca063caed7918f91d9531b5/raw/38060421063bc4766566e5324af489fbce226cac/prepare_env_file.cmd > prepare_env_file.cmd
$ pwsh prepare_env_file.cmd
Once you obtained the credentials, you can run this project using yarn
.
-
First, change into the
node
directory. -
Install dependencies:
yarn
- Build the project:
yarn build
- Run a query, e.g.:
yarn station
Other examples can be found under "scripts"
in the package.json
You can also use the curl script provided in curl_abfragen.sh