Skip to main content
Question

Get Uploaded File Id from return format is Promise Object using NODE BOX API

  • September 6, 2024
  • 1 reply
  • 27 views

Forum|alt.badge.img

By using node sdk , file is uploaded and then after uploading file ,  I would like to get that uploaded file id. File is uploaded successfully response code s200. Althought I try out , I cannot get that uploaded file id. I cannot understand how can I get data from return Promise<Object> data type.
Therefore, could you support and find out solution for that issue. My code snippest is as below.
 

 // Initialize the Box SDK

              var sdk = new BoxSDK({

                clientID: sdkConfig.clientID,

                clientSecret: sdkConfig.clientSecret,

                appAuth: {

                    keyID: sdkConfig.appAuth.keyID,

                    privateKey: sdkConfig.appAuth.privateKey,

                    passphrase: sdkConfig.appAuth.passphrase

                }

            });

 

             var appUserClient = sdk.getAppAuthClient('user',userId);

              var stream =fs.createReadStream(newPath); // upload file’s path

              var parentFolderId = parentFolderId

              var fileName = files.upload[0].originalFilename; // upload file’s name

 

             // File is uploaded

          var response =  appUserClient.files.uploadFile(parentFolderId,fileName,stream);

            // want to accept uploaded file’s id that step ※

 
 

 

 

1 reply

Jey Bueno Box
  • Community Manager
  • 306 replies
  • September 6, 2024

Hi @Ei Ei Cho 👋 Welcome to Box community! The File ID should be returned in the response object. Can you please try to retrieve that in code? Kindly let us know how it goes!

In the event that this needs further investigation and assistance of our Product Support, you may submit a ticket by visiting our Support page. 👈


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings