Last modified: Thu Apr 18 2019 08:29:10 GMT+0000 (Coordinated Universal Time)

How to setup Read API

In this tutorial, you will learn about Winding Tree Read API and how to set it up and work with it.


Step by step

Winding Tree Read API is a REST API that can be used to read inventory registered in Winding Tree ecosystem. It is a fully stateless and cache-less API that for now does not require any prior user authentication.

Running the API

The recommended way of running Winding Tree ecosystem APIs is via docker images. You can grab the latest stable version of Read API on Docker Hub.

First, you need to download the docker image:

$ docker pull windingtree/wt-read-api

And then you need to run it with a configuration meant for the environment you have chosen. You also need to specify to which Ethereum Node the API will connect. We recommend to register with Infura where you will get an HTTP address such as which you would use as ETH_NETWORK_PROVIDER. Be careful to choose the node with appropriate network (i. e. ropsten or mainnet).

$ docker run -p 8081:3000 -e ETH_NETWORK_PROVIDER=address_to_node -e WT_CONFIG=playground windingtree/wt-read-api

The Read API is then exposed on port 8081:

$ curl localhost:8081
   "wtIndexAddress" : "0xfb562057d613175c850df65e435bb0824b65d319",
   "version" : "0.10.0",
   "ethNetwork" : "ropsten",
   "docs" : "",
   "info" : "",
   "config" : "playground",
   "dataFormatVersion" : "0.2.0"

If you need more control over your setup, you can configure everything with environment variables passed to docker run command. Detailed documentation can be found in the source code repository.

Where to next