购买指定音乐,获得音乐的原始文件地址
POST
HFClient client = new DefaultHFClient(url, appkey, secret);
HFOrderMusicRequest request = new HFOrderMusicRequest();
request.setMethod(HFRequest.METHOD_POST);
request.setOrderId("14345565455656gd");
request.setSubject("购买音乐");
request.setWorkId("uEC00xeWbExGNilHpSN7MoM3AalWqwUp1");
request.setMusic("[{"musicId":"B7B810AABADF","price":900,"num":1}]");
request.setTotalFee(900);
request.setDeadline(365);
request.setClientId("hf2y7jk19a56qetq05");
try {
HFOrderMusicResponse response = client.execute(request);
System.out.println(JSON.toJSON(response));
} catch (ApiException e) {
e.printStackTrace();
}
curl -G https://gateway-open.haifanwu.com -H 'Authorization:HF3-HMAC-SHA1 Signature=5199EC5C741F3FA0312C97DD19C90BCF' -H 'X-HF-ClientId:hf2y7jk19a56qetq05' -H 'X-HF-AppId:170ae316b9b14c1b9c185988771bde16' -H 'X-HF-Action:OrderMusic' -H 'X-HF-Timestamp:1595843151795' -H 'X-HF-Version:V4.1.1' -H 'X-HF-Nonce:KLHdStItJmspkYkKMWDSLTVRLGOkakzf'
-X POST -d 'AudioFormat=mp3&AudioRate=320&Deadline=50&Music=[{"versionId":"B7B810AABADF","price":20,"num":1}]&OrderId=143456789056569145&Subject=购买单曲&TotalFee=1556'
{
"code": 10200,
"msg": "操作成功",
"data": {
"subject": "购买单曲",
"totalFee": 1556,
"orderId": "143456789056569145",
"deadline": "2020-09-15 17:45:52",
"createTime": "2020-07-27 17:45:52",
"music": [{
"musicId": "B7B810AABADF",
"fileUrl": "https://static-hifiveai-open.haifanwu.com/WaterMark/hifive/COPYRIGHT/B7B810AABADF/mp3_320/B7B810AABADF.mp3?sign=cc269caccab88bb842403997bc56f19c&t=1595843152",
"expires": 1595843752470,
"waveUrl": "https://static-hifiveai-open.haifanwu.com/wave/COPYRIGHT/B7B810AABADF/B7B810AABADF.json?sign=f1b27e2fd9b25589597e633300a5e797&t=1595843152",
"dynamicLyricUrl": "",
"staticLyricUrl": "",
"fileSize": 7339407
}],
"HForderId": "20200727174552RpHMqd1"
},
"taskId": "0221f2a4711d4e0896dfd83b739c7ea3"
}