Javascript, Update Item field value
Can you give us an example of a properly formatted javascript request that works with the podio-js client library for updating an item's field value?  The docs essentially run in circles and looking at the ruby/php code it seems that there is an options object that is not mentioned anywhere in the js library for put requests. Here's what I'm trying to do: router.get('/app/put/item/field', function(req, res) {    podio.isAuthenticated()    .then(function(error, response, body) {        var requestData = {            "values": " some string 42"        };    return podio.request('put', '/item/{item_id}/value/{field_id}', requestData);    })    .then(function(responseData) {        console.log(responseData);    })    .catch(function(err) {        res.send(err);    });});   Thanks.

  • I have a sort of piggy back question related to the requestData object. My goal is to update an item field value, in my case "lead status". I am taking a look at the app field definitions using the developer tool for my app and see ```"status": integer_value_of_option```so when i pass the request data will it be of this format ? 
  • How about for like Install Share? How do I convert this to Javascript:  PodioAppMarketShare.phpPodioAppMarketShare::install( $share_id, $attributes = array() ); I know I have to use this: /app_store/{share_id}/install but not sure how or where to place the space_id so Podio will know in what workspace it will be installed.   Thanks in advanced!
  • Hi Brian, I can spot 2 problems with your code, so let's start with those: #1 You are returning the result of podio.request, but that will simply be undefined because it's an async operation and the result of that operation will be available to you in the callback (that you're missing there). E.g.  podio.request('put', '/item/{item_id}/value/{field_id}', requestData, function(reponse) {    console.log('Hey there', response);}); #2 The url you're using will never work because you're not actually replacing the placeholders with real values. Something like this will work: var itemId = 12345;var fieldId = 28987;var url = '/item/' + item_id + '/value/' + field_id Or, with the new fancy ES6 syntax (note backticks and dollar signs): const itemId = 12345;const fieldId = 28987;const url = `/item/${item_id}/value/${field_id}`podio.request('PUT', url, requestData, function(reponse) {    console.log('Hey there', response);});   Hope that helps, and for future reference you can take a look at the documentation for making API requests through the podio-js client.
This question is closed.