Coder Social home page Coder Social logo

cryptoportfolio-nodejs's Introduction

API Documentation

Routes

Logics

Authorization Logic
Issues


  • Register

    Request POST /register

    Parameters Data Type Required / Optional Description
    username string Required length 6-30, no space
    email string Required your email
    password string Required length 8-20, must have upper, lower case and digits, no space
    firstname string Required your first name
    lastname string Required your last name
    public string Optional, true by defualt If you willing to share you profile

    Response

    {
        "user": {
            "email": "your email",
            "password": "your password",
            "firstname": "your first name",
            "lastname": "your last name",
            "public": "ture/false",
            "administrator": "true/false",
            "createAt": "some date",
            "upedateAt": "soome date"
        },
        "token": "xxx"
    }
    {
        "error": "Some error message"
    }

  • Register with email verification

    Request POST /verify/register

    Parameters Data Type Required / Optional Description
    username string Required length 6-30, no space
    email string Required your email
    password string Required length 8-20, must have upper, lower case and digits, no space
    firstname string Required your first name
    lastname string Required your last name
    public string Optional, true by defualt If you willing to share you profile

    Response

    {
        "success": "true",
        "message": "We sent a link to your email, please check your email and activate your account"
    }
    {
        "error": "Some error message"
    }

  • login

    Request POST /login

    Parameters Data Type Required / Optional Description
    email/email string Required your email or username
    password string Required your password
    {
        "user": {
            "email": "your email",
            "password": "your password",
            "firstname": "your first name",
            "lastname": "your last name",
            "public": "ture/false",
            "administrator": "true/false",
            "createAt": "some date",
            "upedateAt": "soome date"
        },
        "token": "xxx"
    }
    {
        "error": "Error message showing that why it didn't login successfully"
    }

  • Public

    Purpose: Set your account to public

    Request GET /user/public

    header Data Type Required / Optional Description
    authorization jwt token Required Your jwt token

    Response

    welcome API
    {
        "error": "reason why your request failed"
    }

  • Private

    Purpose: Set your account to private

    Request GET /user/private

    header Data Type Required / Optional Description
    authorization jwt token Required Your jwt token

    Response

    welcome API
    {
        "error": "reason why your request failed"
    }

  • Post Setting

    Request POST /user/setting

    header Data Type Required / Optional Description
    authorization jwt token Required Your jwt token
    Parameters Data Type Required / Optional Description
    email string Required your email
    password string Required your password
    firstname string Required your first name
    lastname string Required your last name
    public string Optional, true by defualt If you willing

    Response

    {
        "email": "your email",
        "password": "your password",
        "firstname": "your first name",
        "lastname": "your last name",
        "public": "ture/false",
        "administrator": "true/false",
        "createAt": "some date",
        "upedateAt": "soome date"
    }
    {
        "error": "reason why your request failed"
    }

  • Get Setting

    Request GET /user/setting

    header Data Type Required / Optional Description
    authorization jwt token Required Your jwt token

    Response

    {
        "email": "your email",
        "password": "your password",
        "firstname": "your first name",
        "lastname": "your last name",
        "public": "ture/false",
        "administrator": "true/false",
        "createAt": "some date",
        "upedateAt": "soome date"
    }
    {
        "error": "reason why your request failed"
    }

  • Post Profile

    Request POST /user/profile

    header Data Type Required / Optional Description
    authorization jwt token Required Your jwt token
    Parameters Data Type Required / Optional Description
    email String Optional Your contact email
    github String Optional Your github account
    interest String Optional Your interest areas
    investment String Optional Your current investment

    Response

    {
        "email": "your email",
        "github": "your github account",
        "interest": "your interest areas",
        "investment": "req.body.investment",
        "createAt": "some date",
        "upedateAt": "soome date"
    }
    {
        "error": "reason why your request failed"
    }

  • Get Profile

    Request GET /user/profile

    header Data Type Required / Optional Description
    authorization jwt token Required Your jwt token

    Response

    {
        "email": "your email",
        "github": "your github account",
        "interest": "your interest areas",
        "investment": "req.body.investment",
        "createAt": "some date",
        "upedateAt": "soome date"
    }
    {
        "error": "reason why your request failed"
    }

  • Update Profile

    Request PUT /user/profile

    header Data Type Required / Optional Description
    authorization jwt token Required Your jwt token
    Parameters Data Type Required / Optional Description
    email String Optional Your contact email
    github String Optional Your github account
    interest String Optional Your interest areas
    investment String Optional Your current investment

    Response

    {
        "email": "your email",
        "github": "your github account",
        "interest": "your interest areas",
        "investment": "req.body.investment",
        "createAt": "some date",
        "upedateAt": "soome date"
    }
    {
        "error": "reason why your request failed"
    }

  • Clear Profile

    Request GET /user/profile/clear

    header Data Type Required / Optional Description
    authorization jwt token Required Your jwt token

    Response

    {
        "email": "",
        "github": "",
        "interest": "",
        "investment": "",
        "createAt": "some date",
        "upedateAt": "soome date"
    }
    {
        "error": "reason why your request failed"
    }

  • Administration:

    This feature is for setting up adminstrator and website management.

  • Administrator Registration:

    Request POST /adminregister

    Parameters Data Type Required / Optional Description
    email string Optional your email
    password string Optional your password
    firstname string Optional your first name
    lastname string Optional your last name
    public string Optional If you willing to share you profile

    Response

    {
        "user": {
            "email": "your email",
            "password": "your password",
            "firstname": "your first name",
            "lastname": "your last name",
            "public": "ture/false",
            "administrator": "true",
            "createAt": "some date",
            "upedateAt": "soome date"
        },
        
        "token": "xxx"
    }
    {
        "error": "reason why your request failed"
    }

  • Administrator List Users:

    list all the users in database

    Request GET /administrator/list

    header Data Type Required / Optional Description
    authorization jwt token Required Your jwt token

    Response

    [
        {
            "email": "your email",
            "password": "your password",
            "firstname": "your first name",
            "lastname": "your last name",
            "public": "ture/false",
            "administrator": "true",
            "createAt": "some date",
            "upedateAt": "soome date"
        },
        {
            
        }, 
        
    ]
    {
        "error": "error messages"
    }

    • Administrator Send Email to All Users:

      Request POST /administrator/sendall

      header Data Type Required / Optional Description
      authorization jwt token Required Your jwt token
      Parameters Data Type Required / Optional Description
      subject string Optional subject
      message string Optional message
      html string Optional html included in email

  • Make Transaction:

    Make a transaction

    Request POST /user/make-transaction

    header Data Type Required / Optional Description
    authorization jwt token Required Your jwt token
    Parameters Data Type Required / Optional Description
    sell_type string required Selling coin's type
    sell_price double required Coin's value in USD
    sell_amount double required Selling coins amount
    income_type string required Income type (USD for example)
    income_price double required Currency's value in USD
    income_amount double required Income amount

    Response

    [
        {	
        	"id": "transaction id",
            "sell_type": "BTC",
            "sell_price": "6000",
            "sell_amount": "2",
            "income_type": "USD",
            "income_price": "1",
            "income_amount": "12000",
            "createAt": "some date",
            "upedateAt": "soome date",
            "portfolioId": "The associate portfolio id",
        }
        
    ]
    {
        "error": "error messages"
    }

  • Asset

    Check user's current assets (All the currency type and amount the user recently hold)

    Request GET /user/asset

    header Data Type Required / Optional Description
    authorization jwt token Required Your jwt token

    Response

    [
        {	
        	"id": "transaction id",
            "type": "BTC",
            "amount": "2",
            "createAt": "some date",
            "upedateAt": "soome date",
            "portfolioId": "The associate portfolio id",
        },
        {
            
        }, 
        
    ]
    {
        "error": "error messages"
    }

  • List Coins:

    Get the current list of all cryptocurrencies and the following information about each coin.

    Request GET /user/coinlist

    header Data Type Required / Optional Description
    authorization jwt token Required Your jwt token

    Response

      {
        "BTC": {
               "Id": "1182",
               "Url": "/coins/btc/overview",
               "ImageUrl": "/media/19633/btc.png",
               "Name": "BTC",
               "Symbol": "BTC",
               "CoinName": "Bitcoin",
               "FullName": "Bitcoin (BTC)",
               "Algorithm": "SHA256",
               "ProofType": "PoW",
               "FullyPremined": "0",
               "TotalCoinSupply": "21000000",
               "PreMinedValue": "N/A",
               "TotalCoinsFreeFloat": "N/A",
               "SortOrder": "1",
               "Sponsored": false
      		},
        "ETH": {},
    }
    {
        "error": "error messages"
    }

  • Exchange List:

Returns all the exchanges that CryptoCompare has integrated with.

Request GET /user/exchange-list

header Data Type Required / Optional Description
authorization jwt token required Your jwt token

Response

      {
        "Cryptsy":
                  {
                    "42":["BTC","XRP"],
                    "EMC2":["BTC","XRP"],
                    "POINTS":["BTC"],
                    "VTC":["BTC","LTC","XRP"]
                    
                  }
                  
	  }
    {
        "error": "error messages"
    }

  • Price

Get the current price of any cryptocurrency in any other currency.

Request POST /user/price

header Data Type Required / Optional Description
authorization jwt token required Your jwt token
Parameters Data Type Required / Optional Description
fsym string required From symbal
tsyms array of strings required To Symbol(s)

Response

   { 
   		"USD": 1100.24,	
       	"BTC": 0.16
   }
    {
        "error": "error messages"
    }

  • Price Multi

Works like price, except it allows you to specify a matrix of From Symbols.

Request POST /user/price-multi

header Data Type Required / Optional Description
authorization jwt token required Your jwt token
Parameters Data Type Required / Optional Description
fsym array of strings required From symbal
tsyms array of strings required To Symbol(s)

Response

   { 
   		"BTC": {"USD": 6213.54}
   }
    {
        "error": "error messages"
    }

  • Price Historical

Get all the current trading info (price, vol, open, high, low, etc.) of any list of cryptocurrencies in any other currency.

Request POST /user/price-historical

header Data Type Required / Optional Description
authorization jwt token required Your jwt token
Parameters Data Type Required / Optional Description
fsym array of strings required From symbal
tsyms array of strings required To Symbol(s)

Response

{
    "BTC": {
      "USD": {
        "TYPE": "5",
        "MARKET": "CCCAGG",
        "FROMSYMBOL": "BTC",
        "TOSYMBOL": "USD",
        "FLAGS": "4",
        "PRICE": 1152.42,
        "LASTUPDATE": 1487865689,
        "LASTVOLUME": 0.21,
        "LASTVOLUMETO": 242.20349999999996,
        "LASTTRADEID": 1224703,
        "VOLUME24HOUR": 53435.45299122338,
        "VOLUME24HOURTO": 60671593.843186244,
        "OPEN24HOUR": 1119.31,
        "HIGH24HOUR": 1170,
        "LOW24HOUR": 1086.641,
        "LASTMARKET": "itBit",
        "CHANGE24HOUR": 33.11000000000013,
        "CHANGEPCT24HOUR": 2.958072383879366,
        "SUPPLY": 16177825,
        "MKTCAP": 18643649086.5
       },
       "EUR": "..."
     },
    "ETH": "..."
 }

Request POST /user/price-multi

header Data Type Required / Optional Description
authorization jwt token required Your jwt token
Parameters Data Type Required / Optional Description
fsym array of strings required From symbal
tsyms array of strings required To Symbol(s)

Response

   { 
   		"BTC": { "USD": 6213.54},	
   }
    {
        "error": "error messages"
    }

  • Authorization

    • Every route start with baseURL/user/ will check the token sent by a client, and the server will recognize the token and know which user you are. If you update your email, username or password, the token will expire.

    • Our backend will send a confirmation link when user registers his/her account. The link contains an encrypted parameter which includes user registration information. When the user clicks the link backend verify and decode the parameter using a private key to acquire the user's registration information then create an account accordingly.


  • Notification

    • Administrators can manually send notifications to every user's email. Whereas at every day 8 am users will receive an email containing the latest news about the coin they hold the most.

  • Issues:

    • We are currently using Gmail for sending email, which could cause problems when it comes to sending bulk emails.

cryptoportfolio-nodejs's People

Contributors

perrysong 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.