RESTful service which connects the client app to the network.
The API component has three functions:
- Identity generation
- Querying the ledger
- Updating the ledger
The API uses the Fabric Node SDK
In order to query or update the ledger, the user needs a private / public key pair, generated by their organisations CA. Each users key pair is stored in their organisations wallet. Wallets don't store tokens of any sort, the only store identities.
Make sure you have set up the host VM as described in the platform docs.
Login to the host VM and start the API container:
$ cd /home/vagrant/api
$ sudo docker-compose up -d
You're done! The network and application components can now use the API.
Normally the network and application components communicate with the API on your behalf, so there's no need to interact with the API directly.
During development it can be useful to run commands directly on the API, so here's how.
Admin identities are generated automatically when organisations are created, so you can probably skip this step. But if you're doing something weird, you might need to create one or regenerate an existing one.
From the host VM:
$ sudo docker exec api.divvy.com node ./lib/security.js enrolladmin <org>
Generate a user identity:
$ sudo docker exec api.divvy.com node ./lib/security.js registeruser <org> <user>
From the host VM:
$ sudo docker exec api.divvy.com node ./lib/query.js \
-o <org> \
-u <user> \
-c <org> \
-n share \
-m queryShare \
-a '["<org>","1"]'