通过音乐id获取时长为15s、128码率的MP3音频格式文件。请注意:禁止在服务端缓存音频数据。
GET
HFClient client = new DefaultHFClient(url, appkey, secret);
HFOrderTrialRequest request = new HFOrderTrialRequest();
request.setMethod(HFRequest.METHOD_GET);
request.setClientId("InstaOpen202012010000360001");
request.setMusicId("125F34E51B0D");
try {
HFOrderTrialResponse 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=A2AC3785169A900845848637EEFCE153' -H 'X-HF-ClientId:hf2y7jk19a56qetq05' -H 'X-HF-AppId:170ae316b9b14c1b9c185988771bde16' -H 'X-HF-Action:OrderTrial' -H 'X-HF-Timestamp:1610589350415' -H 'X-HF-Version:V4.1.1' -H 'X-HF-Nonce:9jpI3WY3A1cq0trM5Ku5JiwuPuqzCgMw'
-X GET - d 'MusicId=125F34E51B0D'
{
"code": 10200,
"msg": "操作成功",
"data": {
"expires": 1610590035863,
"musicId": "125F34E51B0D",
"fileSize": 241206,
"fileUrl": "https://static-hifiveai-open.haifanwu.com/trial/COPYRIGHT/125F34E51B0D/mp3_128/125F34E51B0D.mp3?sign=7e215e09f794821df33cf5786645881a&t=1610589435",
"waveUrl": "https://static-hifiveai-open.haifanwu.com/trial/wave/COPYRIGHT/125F34E51B0D/125F34E51B0D.mp3?sign=2b73591c72cb218729c980068a5bb3b6&t=1610589435"
},
"taskId": "2b6c8767e2358e3a"
}