必需参数丢失错误(PUT 请求)
Required Parameter Missing Error (PUT Request)
我在发出此 PUT 请求时不断收到此错误。
{
"error" : {
"status" : 400,
"message" : "Required parameter position_ms missing"
}
}
我使用的格式与我之前用于所有 PUT 请求的格式相同,并且在我调用之前就存在进度,所以我不确定发生了什么
$.ajax({
url: 'https://api.spotify.com/v1/me/player/seek',
contentType: 'application/json',
type: 'PUT',
dataType: 'json',
headers: {
'Authorization': 'Bearer ' + access_token
},
data: JSON.stringify({'position_ms':progress, "device_id":deviceID}),
success: function(response) {
}
});
请求负载:
{position_ms: 78659, device_id: "9e485fc5aa0b4f0bce19f53571398003ee05d6f5"}
device_id : "9e485fc5aa0b4f0bce19f53571398003ee05d6f5" position_ms :
78659
我使用了一个查询字符串并将其添加到 url 并且成功了!
$.ajax({
url: 'https://api.spotify.com/v1/me/player/seek' + '?' + $.param(seekPos),
contentType: 'application/x-www-form-urlencoded',
type: 'PUT',
headers: {
'Authorization': 'Bearer ' + access_token
},
data: {'device_id':deviceID},
success: function(response) {
}
});
我在发出此 PUT 请求时不断收到此错误。
{
"error" : {
"status" : 400,
"message" : "Required parameter position_ms missing"
}
}
我使用的格式与我之前用于所有 PUT 请求的格式相同,并且在我调用之前就存在进度,所以我不确定发生了什么
$.ajax({
url: 'https://api.spotify.com/v1/me/player/seek',
contentType: 'application/json',
type: 'PUT',
dataType: 'json',
headers: {
'Authorization': 'Bearer ' + access_token
},
data: JSON.stringify({'position_ms':progress, "device_id":deviceID}),
success: function(response) {
}
});
请求负载:
{position_ms: 78659, device_id: "9e485fc5aa0b4f0bce19f53571398003ee05d6f5"}
device_id : "9e485fc5aa0b4f0bce19f53571398003ee05d6f5" position_ms : 78659
我使用了一个查询字符串并将其添加到 url 并且成功了!
$.ajax({
url: 'https://api.spotify.com/v1/me/player/seek' + '?' + $.param(seekPos),
contentType: 'application/x-www-form-urlencoded',
type: 'PUT',
headers: {
'Authorization': 'Bearer ' + access_token
},
data: {'device_id':deviceID},
success: function(response) {
}
});