正在向 shapeshift 发送 post 请求
Sending post request to shapeshift
使用来自 https://info.shapeshift.io/api#api-7 的示例姿势请求:
url: shapeshift.io/shift
method: POST
data type: JSON
data required:
withdrawal = the address for resulting coin to be sent to
pair = what coins are being exchanged in the form [input coin]_[output coin] ie btc_ltc
returnAddress = (Optional) address to return deposit to if anything goes wrong with exchange
destTag = (Optional) Destination tag that you want appended to a Ripple payment to you
rsAddress = (Optional) For new NXT accounts to be funded, you supply this on NXT payment to you
apiKey = (Optional) Your affiliate PUBLIC KEY, for 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 is BTS / BITUSD)],
depositType: [Deposit Type (input coin symbol)],
withdrawal: [Withdrawal Address], //-- will match address submitted in post
withdrawalType: [Withdrawal Type (output coin symbol)],
public: [NXT RS-Address pubkey (if input coin is NXT)],
xrpDestTag : [xrpDestTag (if input coin is XRP)],
apiPubKey: [public API attached to this shift, if one was given]
}
我将 post 请求发送至:
shapeshift.io/shift
带参数
{"withdrawal":"AAAAAAAAAAAAA", "pair":"btc_ltc", returnAddress:"BBBBBBBBBBB"}
但是没有收到回复。
我的 post 格式正确吗?
啊,文档中有错误。示例 POST 字符串无效 JSON "returnAddress"
需要引用。
尝试:
$ curl -H "Content-Type: application/json" -X POST -d '{"withdrawal":"LZwZMi6i9suK1wzFaw1NHqcYLcLGAo1Fs3", "pair":"btc_ltc", "returnAddress":"1HpnZkPHDMdiezuxT1sbKgLgBGTb1Q7eEP"}' https://shapeshift.io/shift
给我以下回复:
{"orderId":"fca7e528-e0ba-4b4e-a43b-237d8a81b2a6","deposit":"1Khh3ndcoKBDsKe2gvmK9f2M1TpimXWWXw","depositType":"BTC","withdrawal":"LZwZMi6i9suK1wzFaw1NHqcYLcLGAo1Fs3","withdrawalType":"LTC","public":null,"apiPubKey":"shapeshift","returnAddress":"1HpnZkPHDMdiezuxT1sbKgLgBGTb1Q7eEP","returnAddressType":"BTC"}
您没有说明您如何查询 API,如果您使用 curl
,无论您做什么,您总是会得到一个错误字符串,例如,
{"error":"No Withdrawal Address Specified"}
使用来自 https://info.shapeshift.io/api#api-7 的示例姿势请求:
url: shapeshift.io/shift
method: POST
data type: JSON
data required:
withdrawal = the address for resulting coin to be sent to
pair = what coins are being exchanged in the form [input coin]_[output coin] ie btc_ltc
returnAddress = (Optional) address to return deposit to if anything goes wrong with exchange
destTag = (Optional) Destination tag that you want appended to a Ripple payment to you
rsAddress = (Optional) For new NXT accounts to be funded, you supply this on NXT payment to you
apiKey = (Optional) Your affiliate PUBLIC KEY, for 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 is BTS / BITUSD)],
depositType: [Deposit Type (input coin symbol)],
withdrawal: [Withdrawal Address], //-- will match address submitted in post
withdrawalType: [Withdrawal Type (output coin symbol)],
public: [NXT RS-Address pubkey (if input coin is NXT)],
xrpDestTag : [xrpDestTag (if input coin is XRP)],
apiPubKey: [public API attached to this shift, if one was given]
}
我将 post 请求发送至:
shapeshift.io/shift
带参数
{"withdrawal":"AAAAAAAAAAAAA", "pair":"btc_ltc", returnAddress:"BBBBBBBBBBB"}
但是没有收到回复。
我的 post 格式正确吗?
啊,文档中有错误。示例 POST 字符串无效 JSON "returnAddress"
需要引用。
尝试:
$ curl -H "Content-Type: application/json" -X POST -d '{"withdrawal":"LZwZMi6i9suK1wzFaw1NHqcYLcLGAo1Fs3", "pair":"btc_ltc", "returnAddress":"1HpnZkPHDMdiezuxT1sbKgLgBGTb1Q7eEP"}' https://shapeshift.io/shift
给我以下回复:
{"orderId":"fca7e528-e0ba-4b4e-a43b-237d8a81b2a6","deposit":"1Khh3ndcoKBDsKe2gvmK9f2M1TpimXWWXw","depositType":"BTC","withdrawal":"LZwZMi6i9suK1wzFaw1NHqcYLcLGAo1Fs3","withdrawalType":"LTC","public":null,"apiPubKey":"shapeshift","returnAddress":"1HpnZkPHDMdiezuxT1sbKgLgBGTb1Q7eEP","returnAddressType":"BTC"}
您没有说明您如何查询 API,如果您使用 curl
,无论您做什么,您总是会得到一个错误字符串,例如,
{"error":"No Withdrawal Address Specified"}