[英]Axios post spotify api request return 400
我正在为一个项目使用 spotify api。 除了这个请求,我提出的每一个请求都很好。 我希望能够创建一个新的播放列表。 scope
已经检查过了,这不是问题的根源。 为此,我提出了以下要求
axios('https://api.spotify.com/v1/users/' + ID + '/playlists', {
method: 'POST',
headers: {
'Authorization' : 'Bearer ' + data.data.access_token,
"Content-Type" : "application/json"
},
data: {
name: Name,
Description: Description
}
})
当我尝试时,我收到了400 Bad Request - The request could not be understood by the server due to malformed syntax. The message body will contain more information
400 Bad Request - The request could not be understood by the server due to malformed syntax. The message body will contain more information
这是 Spotify api 参考的链接
https://developer.spotify.com/documentation/web-api/reference/playlists/create-playlist/
假设您的 ID 已定义。 您需要将 json 字符串化。
好久没用axios了
axios('https://api.spotify.com/v1/users/' + ID + '/playlists', {
method: 'POST',
headers: {
'Authorization' : 'Bearer ' + data.data.access_token,
'Content-Type': 'application/json'
},
data: JSON.stringify({
name: Name,
description: Description
})
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.