uploading file from js fetch api to box and keep getting 415 error. Can anyone please let me know what mistake I am making here? Thanks

新規投稿

コメント

4件のコメント

  • Peter Christensen

    Hi 

    I think you might get this as you add the application/json header which should not be used in this call. try removing it and test again

    Rgds,
    Peter Christensen, Platform Solutions Engineer, Box

    0
    コメントアクション パーマリンク
  • Nidhi Joshi

    Hi Peter Christensen,

    Thanks for the quick response.

    I tried the above solution which you suggested but it didn't work. Still facing the same issue.

    I want to upload files to box from js fetch api. One thing I need to confirm is in my app I also need to add the allowed origin to the value from where I am generating request right? I have added the origin value but the app is still not authorized by the box admin. So wanted to know is this the reason why I am facing this 415 issue. Right now, I am using some extension for by passing CORS only for testing.

    Thanks

    0
    コメントアクション パーマリンク
  • Peter Christensen

    a 415 is normally when you send the wrong content-type header or no content-header with your request. A CORS issue would show as a 403 with a context saying something around CORS

    0
    コメントアクション パーマリンク
  • Nidhi Joshi

    @Peter Christensen, I have added the origin from where I am passing request to box i.e "https://contentintelligence.lightning.force.com" in the Allowed Origins but still I am getting "Access to XMLHttpRequest at 'https://upload.box.com/api/2.0/files/content' from origin 'https://contentintelligence.lightning.force.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."

    0
    コメントアクション パーマリンク

投稿コメントは受け付けていません。