Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

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.