Podio - 更新项目字段导致空字段

Podio - updating item field results in empty field

我正在尝试通过 AJAX 请求更新跑道中的项目字段值 - 我可以成功发出请求,但不是将字段值更新为请求中传递的值,项目字段in Podio 只是清空(好像更新为空值)。这是电话:

    $.ajax({
        type:'PUT',
        beforeSend: function (xhr) {
                xhr.setRequestHeader('Authorization', 'OAuth2 ' + response.access_token)
            },
        url:'https://api.podio.com/item/654321/value/12345',
        data: JSON.stringify({'value': 'new_value'})
    }).done(function(response){
        console.log(response)
    }).fail(function(error){
        console.log(error)
    })

但这样做的结果将是简单地删除旧字段值。关闭,但没有雪茄。

跑道应该如何格式化data属性才能正确更新字段值?

(我知道有很多跑道客户端库可以帮助解决这个问题,但在我们目前的情况下它们对我们没有用 - 我们需要通过良好的 ol 来处理这个过程' AJAX )

知道了 - 这是一个简单的修复,只需设置 contentType。傻我。

$.ajax({
    type:'PUT',
    beforeSend: function (xhr) {
            xhr.setRequestHeader('Authorization', 'OAuth2 ' + response.access_token)
        },
    contentType: 'application/json',
    url:'https://api.podio.com/item/654321/value/12345',
    data: JSON.stringify({'value': 'new_value'})
}).done(function(response){
    console.log(response)
}).fail(function(error){
    console.log(error)
})