Welcome to the new Box Support website. Check out all the details here on what’s changed.

Modifying tags with javascript/jquery

Answered
New post

Comments

1 comment

  • KPAX

    Figured it out:

     

    writeTags = function(tags, callback)
    {
         var authHeader = "Bearer " + access_token;

         var tagsArray = tags.split(',');
         var url = "https://api.box.com/2.0/files/" + currentFile.id;

         $.ajax({
              url: url,
              type: 'PUT',
              data: JSON.stringify({tags:tagsArray}),
              beforeSend: function(xhr) {
                   xhr.setRequestHeader("Authorization", authHeader);
             }, success: function(data){

                    callback(data);
             },
             error: function(xhr, textStatus, error){
                  console.log(xhr, textStatus, error);}
       });
    };

     

    0
    Comment actions Permalink

Please sign in to leave a comment.