Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

tuum-tech/assist-restapi-backend

Repository files navigation

Assist Rest API

To start, clone assist-restapi-backend repo

git clone https://github.com/tuum-tech/assist-restapi-backend.git;
cd assist-restapi-backend;

Prerequisites

Run

  • Copy example environment file
    cp .env.example .env
    
  • Modify .env file with any number of wallets to use
  • [OPTIONAL]: If you want to remove previous mongodb data and start fresh, remove the mongodb directory
    rm -rf ~/.tuum-mongodb-data
    
  • Start API server
    ./run.sh start
    

Verify

  • To check whether the API is working:
    curl http://localhost:8000
    
  • To create a transaction, run the following:
    curl -XPOST -H "Content-Type: application/json" -H "Accept: application/json" -d @test/example_did_request2.json http://localhost:8000/v2/didtx/create
    
  • To retrieve a particular transaction according to confirmation ID:
    curl -H "Authorization: assist-restapi-secret-key" http://localhost:8000/v2/didtx/confirmation_id/5ed561723947b48ab7edc527
    
  • To retrieve all transactions for a particular DID:
    curl -H "Authorization: assist-restapi-secret-key" http://localhost:8000/v2/didtx/did/did:elastos:ii4ZCz8LYRHax3YB79SWJcMM2hjaHT35KN
    
  • To retrieve recent 5 requests for a particular DID:
    curl -H "Authorization: assist-restapi-secret-key" http://localhost:8000/v2/didtx/recent/did/did:elastos:ii4ZCz8LYRHax3YB79SWJcMM2hjaHT35KN
    
  • To check the tx details:
    curl -XPOST -H "Content-Type: application/json" \
    --data-raw '{
        "jsonrpc":"2.0",
        "method":"eth_getTransactionReceipt",
        "params":["0x3c149cecb180eb911196d31582dbc598f10399c799216b32cdf45216926b09b0"],
        "id":1
    }' https://api.elastos.io/eid
    
  • To check the balance of an address:
    curl -XPOST -H "Content-Type: application/json" \
    --data-raw '{
        "jsonrpc":"2.0",
        "method":"eth_getBalance",
        "params":["0x365b70f14e10b02bef7e463eca6aa3e75ca3cdb1", "latest"],
        "id":1
    }' https://api.elastos.io/eid
    
  • To resolve DID:
    curl -XPOST -H "Content-Type: application/json" \
    --data-raw '{
        "jsonrpc":"2.0",
        "method":"did_resolveDID",
        "params": [{
            "did": "ieaqHhcz7wVmkVZLxAaPToGf2hb9CXAEh3",
            "all": false
        }],
        "id":1
    }' https://api.elastos.io/eid
    

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •