Javascript, Update Item field value

Comments

3 comments

  • Official comment
    Domenico Matteo

    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.

    Comment actions Permalink
  • Tikboy

    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!

    0
    Comment actions Permalink
  • Domenico Matteo

    You will still use a POST where `share_id` is the ID of your share (app or pack) and you can pass a payload as shown here: https://developers.podio.com/doc/app-market/install-share-22499

    { 
    "space_id": The id of the space the shared app should be installed to,
    "dependencies": The list of ids of the dependent shares that should also be installed. If not specified, all dependencies will be installed
    }
    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk