Skip to content

Rest API

altvnv edited this page Jun 29, 2018 · 34 revisions

Authentification

Here's an example of authentification method. It returns your JWT token.

Request:

curl --request POST \
  --url http://test.multy.io/auth \
  --header 'content-type: application/json' \
  --data '{
	"userID": "sample",
	"deviceID": "sample",
	"deviceType": 1,
	"pushToken": "no",
	"appversion": "1"
}'

Response:

{  
   "expire": "2018-06-29T14:05:46+02:00",
   "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MzAyNzM5NDYsImlkIjoic2FtcGxlIiwib3JpZ19pYXQiOjE1MzAyNzAzNDZ9.YJbzQzHhMxRX64Z3w9QXqG0QHgZT2KORROS-pobQGyw"
}

Getting server config

It returns server configuration.

Request:

curl --request GET \
  --url http://test.multy.io/server/config \
  --header 'content-type: application/json'

Response:

{
	"android": {
		"hard": 7,
		"soft": 7
	},
	"api": "0.01",
	"donate": [
		{
			"FeatureCode": 10000,
			"DonationAddress": "1FPv9f8EGRDNod7mSvJnUFonUioA3Pw5ng"
		},
		...
		{
			"FeatureCode": 20409,
			"DonationAddress": "1KbRaapwNnTJMZcpbTQfb7xJnymKFJDyC1"
		}
	],
	"ios": {
		"hard": 29,
		"soft": 29
	},
	"servertime": 1530269261,
	"stockexchanges": {
		"gdax": [
			"eur_btc",
			"usd_btc",
			"eth_btc",
			"eth_usd",
			"eth_eur",
			"btc_usd"
		],
		"poloniex": [
			"usd_btc",
			"eth_btc",
			"eth_usd",
			"btc_usd"
		]
	},
	"version": {
		"branch": "release_1.1",
		"commit": "161a198",
		"build_time": "2018-06-22T15:57:34+0300",
		"tag": ""
	}
}

Getting donation adresses amount

It returns donation information.

Request:

curl --request GET \
  --url http://test.multy.io/server/config \
  --header 'content-type: application/json'

Response:

{
	"code": 200,
	"donations": [
		{
			"id": 10000,
			"address": "1FPv9f8EGRDNod7mSvJnUFonUioA3Pw5ng",
			"amount": 0,
			"status": 1
		},
		...
		{
			"id": 20409,
			"address": "1KbRaapwNnTJMZcpbTQfb7xJnymKFJDyC1",
			"amount": 0,
			"status": 1
		}
	],
	"message": "OK"
}

Creating new wallet

This method adds new wallet and returns wheter it created or not.

Request:

curl --request POST \
  --url http://test.multy.io/api/v1/wallet \
  --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MzAyNzM5NDYsImlkIjoic2FtcGxlIiwib3JpZ19pYXQiOjE1MzAyNzAzNDZ9.YJbzQzHhMxRX64Z3w9QXqG0QHgZT2KORROS-pobQGyw' \
  --header 'content-type: application/json' \
  --data '{
	"currencyID": 0,
	"networkID": 0,
	"address": "sample",
	"addressIndex": 0,
	"walletIndex": 0,
	"walletName": "sample"
}'

Response:

{
	"code": 200,
	"message": "OK"
}

Deleting wallet

This method accepts 3 parameters /:currencyid/:networkid/:walletindex. This method deletes wallet and returns wheter it deleted or not. Wallet can be deleted if its balance equals 0.

Request:

curl --request DELETE \
  --url http://test.multy.io/api/v1/wallet/0/0/0 \
  --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MzAyNzM5NDYsImlkIjoic2FtcGxlIiwib3JpZ19pYXQiOjE1MzAyNzAzNDZ9.YJbzQzHhMxRX64Z3w9QXqG0QHgZT2KORROS-pobQGyw' \
  --header 'content-type: application/json' \
  --data '{
	"currencyID": 0,
	"networkID": 0,
	"address": "sample",
	"addressIndex": 0,
	"walletIndex": 0,
	"walletName": "sample"
}'

Response:

{
	"code": 200,
	"message": "OK"
}

Adding address for wallet

This method adds new address for wallet that's sent in request.

Request:

curl --request POST \
  --url http://test.multy.io/api/v1/address \
  --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MzAyNzM5NDYsImlkIjoic2FtcGxlIiwib3JpZ19pYXQiOjE1MzAyNzAzNDZ9.YJbzQzHhMxRX64Z3w9QXqG0QHgZT2KORROS-pobQGyw' \
  --header 'content-type: application/json' \
  --data '{
	"walletIndex": 0,
	"address": "sample",
	"addressIndex": 0,
	"currencyID": 0
}'

Response:

{
	"code": 200,
	"message": "OK"
}

Get fee rate for selected currency

This method accepts 2 parameters /:currencyid/:networkid. It returns fee rates in sat/byte.

Request:

curl --request GET \
  --url http://test.multy.io/api/v1/transaction/feerate/0/0 \
  --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MzAyNzQ3ODEsImlkIjoiYWxleCIsIm9yaWdfaWF0IjoxNTMwMjcxMTgxfQ.5xuNbsYt_mge-OWYkTzaUApOx4DLQDVqJG_ssmSAk2I'

Response:

{
	"code": 200,
	"message": "OK",
	"speeds": {
		"VerySlow": 2,
		"Slow": 2,
		"Medium": 3,
		"Fast": 5,
		"VeryFast": 10
	}
}

Getting spendable outputs

This method accepts 3 parameters /:currencyid/:networkid/:addr. It returns all spendable outputs of selected address.

Request:

curl --request GET \
  --url http://test.multy.io/api/v1/outputs/spendable/0/0/n34J7cyue3NjttDeCdAn7XcPnVKNb2CxAg \
  --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MjI2NjMzNDgsImlkIjoiZ0JvVkhtV2FmOXg3RVdneXNFSGYydG9laExpOHpmQjF0Yk5Edzg0dDNhS1hLd3ppVyIsIm9yaWdfaWF0IjoxNTIyNjU5NzQ4fQ.AqKEtMS4J4FNmOy9XKEIOrmXpx6ZJ6MjrSuGCo2x64A'

Response:

{
    "code": 200,
    "message": "OK",
    "outs": [
        {
            "txid": "4745ad96ec7fe551f693b63982764bc284afba077f19180c64efd757a7658786",
            "txoutid": 0,
            "txoutamount": 449218,
            "txoutscript": "76a914ec4814cecf2cc4d2b87d02456928a26ccde9b66788ac"
        },
        {
            "txid": "647f606017217d781c34fc0b98f85846c9eade1b315b28ad3ebe781df427e8f8",
            "txoutid": 0,
            "txoutamount": 112304,
            "txoutscript": "76a914ec4814cecf2cc4d2b87d02456928a26ccde9b66788ac"
        }
    ]
}

Sending transaction

It sends tx and returns TxID.

Request:

curl --request POST \
  --url http://test.multy.io/api/v1/transaction/send \
  --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MjE1NjA4MzUsImlkIjoiamtiZ20iLCJvcmlnX2lhdCI6MTUyMTU1NzIzNX0.zypYYz2tC5panICY_0fAxiKIyhFj0VtKn1vEMiNUdHg' \
  --header 'content-type: application/json' \
  --data '{
  "currencyid": 0,
  "networkid":0,
  "payload": {
  "address": "n4bveXeaGsfkeU6bWEEiHNTMSBzG4PtN3v",
  	"addressindex": 1,
  	"walletindex": 1,
  	"transaction": "kek",
  	"ishd": false
  }
}'

Response:

{
    "code": 200,
    "message": "sent"
    "txid":"76a914ec4814cecf2cc4d2b87d02456928a26ccde9b66788ac"
}

Getting all wallet data verbose

It return server configuration.

Request:

curl --request GET \
  --url http://test.multy.io/api/v1/wallets/verbose \
  --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MjIyNTgwOTcsImlkIjoiamtiZ20iLCJvcmlnX2lhdCI6MTUyMjI1NDQ5N30.S2HR8ZSpYFxFfI-KLO_Y0yQrfTW9rv3WmtdBniK1k4w'

Response:

{
	"code": 200,
	"message": "OK",
	"topindexes": [
		{
			"currencyid": 0,
			"networkid": 0,
			"topindex": 3
		},
		{
			"currencyid": 60,
			"networkid": 0,
			"topindex": 1
		}
	],
	"wallets": [
		{
			"currencyid": 60,
			"networkid": 0,
			"walletindex": 0,
			"walletname": "mY awesome Ethereum wallet",
			"lastactiontime": 1234553,
			"dateofcreation": 12312312,
			"nonce": 1,
			"balance": 123456789123456780,
			"pending": "true",
			"addresses": [
				{
					"lastActionTime": 1517320476,
					"address": "0xMiGR2q7nSFawjifK5vhixSAeHoH2Do5yKu",
					"addressindex": 0,
					"amount": 123456789012345680
				}
			]
		},
		{
			"currencyid": 0,
			"walletindex": 0,
			"walletname": "leshhhhha",
			"lastactiontime": 1517322474,
			"dateofcreation": 1517320476,
			"addresses": [
				{
					"lastActionTime": 1517320476,
					"address": "miGR2q7nSFawjifK5vhixSAeHoH2Do5yKu",
					"addressindex": 0,
					"amount": 130000000,
					"spendableoutputs": [
						{
							"txid": "01d47c5995f9f0ea5f9f8e2a99be2c5c0f0ab7d18af899261ac136059b33e09d",
							"txoutid": 0,
							"txoutamount": 130000000,
							"txoutscript": "76a9141e287510abb23911b17dcf0a55e2aa84966231b988ac",
							"address": "miGR2q7nSFawjifK5vhixSAeHoH2Do5yKu",
							"userid": "2bPz7hrZ1wAMUASVQMq1iMPTA5tvqjrsVcf4rGpSWyJ619YYzG",
							"walletindex": 0,
							"addressindex": 0,
							"txstatus": 2,
							"stockexchangerate": [
								{
									"exchanges": {
										"eur_btc": 0,
										"usd_btc": 0.00009417854283537195,
										"eth_btc": 0.10689699649810791,
										"eth_usd": 1135.949951171875,
										"eth_eur": 0,
										"btc_usd": 10618.1298828125
									},
									"timestamp": 1517320472,
									"stock_exchange": "Poloniex"
								},
								{
									"exchanges": {
										"eur_btc": 0.00011664759372189893,
										"usd_btc": 0.00009510187277319754,
										"eth_btc": 0.10696999728679657,
										"eth_usd": 1125,
										"eth_eur": 913.8499755859375,
										"btc_usd": 10515.0400390625
									},
									"timestamp": 1517320472,
									"stock_exchange": "Gdax"
								}
							]
						}
					]
				}
			]
		},
		{
			"currencyid": 0,
			"walletindex": 1,
			"walletname": "Personal",
			"lastactiontime": 1517322474,
			"dateofcreation": 1517322474,
			"addresses": [
				{
					"lastActionTime": 1517322474,
					"address": "mnFuUUTBjrYS4SaAYpMxqQMKhu1E7fTgR6",
					"addressindex": 0,
					"amount": 4978940,
					"spendableoutputs": [
						{
							"txid": "ad94a40e1989303b62e613ab67a301b5cfb0eb5b988febf6b5542973c89e01c3",
							"txoutid": 0,
							"txoutamount": 4978940,
							"txoutscript": "76a91449f04968d246a0728af15972c5524c46623f6c9988ac",
							"address": "mnFuUUTBjrYS4SaAYpMxqQMKhu1E7fTgR6",
							"userid": "2bPz7hrZ1wAMUASVQMq1iMPTA5tvqjrsVcf4rGpSWyJ619YYzG",
							"walletindex": 1,
							"addressindex": 0,
							"txstatus": 2,
							"stockexchangerate": [
								{
									"exchanges": {
										"eur_btc": 0,
										"usd_btc": 0.0000943649908832729,
										"eth_btc": 0.10753200203180313,
										"eth_usd": 1138.989990234375,
										"eth_eur": 0,
										"btc_usd": 10597.150390625
									},
									"timestamp": 1517322473,
									"stock_exchange": "Poloniex"
								},
								{
									"exchanges": {
										"eur_btc": 0.00011651888453649891,
										"usd_btc": 0.00009501187648456056,
										"eth_btc": 0.10739000141620636,
										"eth_usd": 1127.5,
										"eth_eur": 917.8900146484375,
										"btc_usd": 10525
									},
									"timestamp": 1517322473,
									"stock_exchange": "Gdax"
								}
							]
						}
					]
				},
				{
					"lastActionTime": 1517323545,
					"address": "mpcoJoFaLg4StZEap3rfP3j9c2vHFyMdxh",
					"addressindex": 1,
					"amount": 0,
					"spendableoutputs": []
				},
				{
					"lastActionTime": 1517324057,
					"address": "mtB3R4yyk6A6hzvXJ57xKXzk1M3TcXCJJz",
					"addressindex": 2,
					"amount": 0,
					"spendableoutputs": []
				}
			]
		},
		{
			"currencyid": 0,
			"walletindex": 2,
			"walletname": "Personal",
			"lastactiontime": 1517322480,
			"dateofcreation": 1517322480,
			"addresses": [
				{
					"lastActionTime": 1517322480,
					"address": "miiu7vfVGHF273MwJYyu4VEsvqPn7BhYsx",
					"addressindex": 0,
					"amount": 0,
					"spendableoutputs": []
				}
			]
		}
	]
}

Getting selected wallet verbose

This method accepts 3 parameters /:walletindex/verbose/:currencyid/:networkid. It returns all the data of wallet.

Request:

curl --request GET \
  --url http://test.multy.io/api/v1/0/verbose/0/0 \
  --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MjIyNTgwOTcsImlkIjoiamtiZ20iLCJvcmlnX2lhdCI6MTUyMjI1NDQ5N30.S2HR8ZSpYFxFfI-KLO_Y0yQrfTW9rv3WmtdBniK1k4w'

Response: Bitcoin wallet: { "code": 200, "message": "OK", "wallet": { "currencyid": 0, "walletindex": 0, "networkid": 0, "walletname": "leshhhhha", "lastactiontime": 1517322474, "dateofcreation": 1517320476, "addresses": [ { "lastActionTime": 1517320476, "address": "miGR2q7nSFawjifK5vhixSAeHoH2Do5yKu", "addressindex": 0, "amount": 130000000, "spendableoutputs": [ { "txid": "01d47c5995f9f0ea5f9f8e2a99be2c5c0f0ab7d18af899261ac136059b33e09d", "txoutid": 0, "txoutamount": 130000000, "txoutscript": "76a9141e287510abb23911b17dcf0a55e2aa84966231b988ac", "address": "miGR2q7nSFawjifK5vhixSAeHoH2Do5yKu", "userid": "2bPz7hrZ1wAMUASVQMq1iMPTA5tvqjrsVcf4rGpSWyJ619YYzG", "walletindex": 0, "addressindex": 0, "txstatus": 2, "stockexchangerate": [ { "exchanges": { "eur_btc": 0, "usd_btc": 0.00009417854283537195, "eth_btc": 0.10689699649810791, "eth_usd": 1135.949951171875, "eth_eur": 0, "btc_usd": 10618.1298828125 }, "timestamp": 1517320472, "stock_exchange": "Poloniex" }, { "exchanges": { "eur_btc": 0.00011664759372189893, "usd_btc": 0.00009510187277319754, "eth_btc": 0.10696999728679657, "eth_usd": 1125, "eth_eur": 913.8499755859375, "btc_usd": 10515.0400390625 }, "timestamp": 1517320472, "stock_exchange": "Gdax" } ] } ] } ] } }

Ethereum wallet: { "code": 200, "message": "OK", "wallet": { "currencyid": 60, "networkid": 0, "walletindex": 0, "walletname": "mY awesome Ethereum wallet", "lastactiontime": 1234553, "dateofcreation": 12312312, "nonce": 1, "balance": 123456789123456780, "pending": "true", "addresses": [ { "lastActionTime": 1517320476, "address": "0xMiGR2q7nSFawjifK5vhixSAeHoH2Do5yKu", "addressindex": 0, "amount": 123456789012345680 } ] } }

Sample

Clone this wiki locally