使用 Podio-js PUT 请求更新 App Item Field

Update App Item Field using Podio-js PUT request

我正在使用 Podio-js SDK 从 App Item 获取数据,将其格式化为 URL,然后将 URL 放回同一项目的字段中。 PUT 请求 returns 一个空响应(有时说它无法读取未定义的 属性 'values',或者它清空字段中的现有文本而不是更新它。我认为它与我传递的信息的格式有关。我尝试使用 {"key" : 'value'} 对语法以 JSON 对象格式格式化,但我得到类似的结果。

app.post('/signup',urlencodedParser, function(req, res) {

  //gather information from the item student registry entry and format a link
  //to pre-populated Podio webform

  podio.isAuthenticated().then(function() {

    var itemID = Object.keys(req.body)[0];
    var token = podio.authObject.accessToken;
    var itemPath = `/app/${creds.appID}/item/${itemID}?oauth_token=${token}`;
    var fieldPath = `/item/571453849/value/signup-link`;
    var link;   

    podio.request('GET', itemPath).then(function(responseData) {

        //this request works
        //console.log(JSON.stringify(responseData, null, 4));

          var student = {
            "studentID": responseData.app_item_id,
         }

         var requestData = { url: `www.example.com/${student.studentID}` }

         console.log('\n');
         console.log('fieldpath: ' + fieldPath + '\n');
         console.log('generatedlink: ' + link + '\n');

    }).catch(function(f) {
        console.log(f)
        })

    podio.request('PUT', fieldPath, link).then(function(responseData) {
        //I want to PUT this item 'link' back into a field in the same 
        //item, but I get the error message below
        console.log(JSON.stringify(responseData, null, 4));
        res.end();
    }).catch(function(f) {
        console.log(f)
        })
})

我没有正确处理承诺。我将 GET 和 PUT 请求放在同一个承诺链中,最后使用相同的 .catch。此外,我按照如下所示格式化了我的请求,并且能够成功地将数据放入字段中。

app.post('/signup', urlencodedParser, (req, res) => {

    podio.isAuthenticated()
    .then(function() {

        var appItemID = Object.keys(req.body)[0];
        var token = podio.authObject.accessToken;
        var itemPath = `/app/${creds.appID}/item/${appItemID}?oauth_token=${token}`;

        return podio.request('GET', itemPath)
    })
    .then(function(responseData) {
        //this request works
        //console.log(JSON.stringify(responseData, null, 4));
        var student = {
            "itemID": responseData.item_id,
        }

        var fieldPath = `/item/${student.itemID}/value/signup-link-2`;  
        var requestData = { url: `https://podio.com/webforms/[formattedLink`

        return podio.request('PUT', fieldPath, requestData)
    })
    .then(function(responseData) {

        res.end(JSON.stringify(responseData, null, 4))
    })
    .catch(function(f) {
        console.log(f)
        res.end(JSON.stringify(f, null, 4))
    })
})