BOX File content API range header.
回答済みI'm trying to extract some portion of the file using file/{:id}/content API with range attribute in the header, but it is giving me CORS error.
-
Hi there,
This information should give you more details on how to address the CORS issue, which I'm guessing is related to making the request from JavaScript?
- Jon
-
Hi Jon,
Yeah, I was trying to make a range request in javascript.
I figured out after some trial and error that the BOX API was expecting range: bytes={start}-{end} in the request header. But the API reference documentation did not specify that it requires bytes= in the range attribute. Below is the working code, I was not including bytes= earlier and that was causing the issue.
const response = await fetch(`https://api.box.com/2.0/files/${id}/content`, {headers: {"Authorization": `Bearer ${access_token}`,'range': `bytes=${start}-${end}`},});Thanks,Bhaumik
サインインしてコメントを残してください。
コメント
2件のコメント