Giter Site home page Giter Site logo

assist-restapi-backend's Introduction

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
    

assist-restapi-backend's People

Contributors

kpachhai avatar rtrapp avatar smwashi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.