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

Upload file using /files/content using REST calls

New post

Comments

1 comment

  • Chris Dascalos

    Hey Dindayal Pandey,

    I am not an Angular developer by any means, but I will give it a shot.

    Whenever I struggle with using the API I will always make sure to use Postman first and confirm that someone other than me can make the call successfully before writing my code. Can you confirm this works for you in Postman or another API client?

    Inside of your code, it looks like you might be missing a ":" in the Authorization header. Could it be as simple as having that missing which is why it cannot parse the token from the string?

    Once again, I am not an Angular developer by any means so take this with a grain of salt, but I would suggest using a local file in your application to upload before using something that you are creating in memory. A file structure is much more complicated than a "blob" of data and the string "text" is drastically different than a Word file for example with the single string of "text". Working with variables that we know to be successful can help limit where things are not working.

    Let us know what you find out after changing the implementation around a bit. I might also suggest a linter on your code since I am not qualified to look for any other potential syntax issues.

    Hopefully this helps!

    0
    Comment actions Permalink

Post is closed for comments.