json - Sending post request to shapeshift -


using example pose request https://info.shapeshift.io/api#api-7 :

url:  shapeshift.io/shift method: post data type: json data required: withdrawal     = address resulting coin sent pair       = coins being exchanged in form [input coin]_[output coin]  ie btc_ltc returnaddress  = (optional) address return deposit if goes wrong exchange desttag    = (optional) destination tag want appended ripple payment rsaddress  = (optional) new nxt accounts funded, supply on nxt payment apikey     = (optional) affiliate public key, volume tracking, affiliate payments, split-shifts, etc...  example data: {"withdrawal":"aaaaaaaaaaaaa", "pair":"btc_ltc", returnaddress:"bbbbbbbbbbb"}  success output:     {         deposit: [deposit address (or memo field if input coin bts / bitusd)],         deposittype: [deposit type (input coin symbol)],         withdrawal: [withdrawal address], //-- match address submitted in post         withdrawaltype: [withdrawal type (output coin symbol)],         public: [nxt rs-address pubkey (if input coin nxt)],         xrpdesttag : [xrpdesttag (if input coin xrp)],         apipubkey: [public api attached shift, if 1 given]     }   

i send post request :

 shapeshift.io/shift 

with parameters

{"withdrawal":"aaaaaaaaaaaaa", "pair":"btc_ltc", returnaddress:"bbbbbbbbbbb"} 

but not receive response.

is post format correct ?

ah, there mistake in documentation. example post string no valid json "returnaddress" needs enquoted.

try:

 $ curl -h "content-type: application/json" -x post -d '{"withdrawal":"lzwzmi6i9suk1wzfaw1nhqcylclgao1fs3", "pair":"btc_ltc", "returnaddress":"1hpnzkphdmdiezuxt1sbkglgbgtb1q7eep"}' https://shapeshift.io/shift 

gives me following response:

{"orderid":"fca7e528-e0ba-4b4e-a43b-237d8a81b2a6","deposit":"1khh3ndcokbdske2gvmk9f2m1tpimxwwxw","deposittype":"btc","withdrawal":"lzwzmi6i9suk1wzfaw1nhqcylclgao1fs3","withdrawaltype":"ltc","public":null,"apipubkey":"shapeshift","returnaddress":"1hpnzkphdmdiezuxt1sbkglgbgtb1q7eep","returnaddresstype":"btc"} 

you did not state how query api, if use curl error string back, whatever do, e.g.,

{"error":"no withdrawal address specified"} 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -