11.1. Getting ready

Postman Collections are simply a collection of pre-built requests that can be organized into folders, and they can be easily exported and shared with others. Below is exported Cargox collection which you can start using immediately.

Please head to https://www.postman.com/downloads/ and download Postman app for your system.

After you install it on your system, download Example Postman collection.

11.1.1. Setting up Postman Collection

Here is a json collection file JSON. You can easily import it into Postman via File->Import command.

The following URLs are available within this Postman Collection. They are already set up in collection.

Postman will import collection and you can try it after setting up OAuth for authentication.

Important

Third-party system requires the client_id and client_secret before using this postman examples.

Please insert client_id and client_secret into collection variables as shown below.

Tip

You can always change the data (like email etc) to your needs. Simply go to collection variables and change it.

../_images/postman1.png

11.1.2. Install Web3 local signing service

CargoX uses the most advanced and fastest-developed blockchain on the planet - the public, open-source blockchain called Ethereum.

When creating new company we downloaded private key in JSON format. To ease the process of signing the transactions, we created a docker image that exposes few endpoint that decrypts a private key and sign the transaction.

If you do not have docker installed, please follow instructions: https://docs.docker.com/get-docker/

To start this service, simply start docker container: docker run -p 5000:5000 -d cargoxdevelopers/web3-sign

To test that Web3 local signing service is working, simply open your browser and try url: http://localhost:5000/ You should get response: {"message":"web3 sign hash app is working OK!"}

you can change the port 5000 to any other port, but do not forget changing the web3_docker_service variable in Postman collection.

Alternately, you can sign hash of the transaction online with a help of metamask: https://support.mycrypto.com/how-to/getting-started/how-to-sign-and-verify-messages-on-ethereum/

11.1.3. Oauth Authorization

Now we can start using this postman collection. First, we obtain new Oauth Access token. Go to authorization tab and click "Get New Access Token". If client_id and client_secret is set properly set up, we should obtain new access token. Please click "Proceed" and "Use Token".

../_images/access_token.png

Tip

This authorization method will be used for every request in this collection - this token will be automatically added to request headers of every call. If access token expires, repeat this steps to obtain a new one.

../_images/proceed.png ../_images/use_token.png