We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
varunvyas5678
3 years agoExplorer | Level 3
Error : POST https://content.dropboxapi.com/2/files/upload_session/append_v2 400 (Bad Request)
Getting error while appending blobs to session using 'https://content.dropboxapi.com/2/files/upload_session/append_v2' in Salesforce LWC JS:
uploadFile(event){
var file = eve...
varunvyas5678
Explorer | Level 3
Response for the callout is:
Error in call to API function "files/upload_session/append:2": The given OAuth 2 access token is malformed.
Greg-DB
3 years agoDropbox Staff
That error message indicates that there's an issue with the access token value you're supplying with the API call. Check the access token you're sending and make sure you're using the exact value as it was provided to you by Dropbox. Don't add or remove any characters, make sure there's no stray whitespace, etc. (As a matter of security, do not share any access tokens or refresh tokens here.)
- varunvyas56783 years agoExplorer | Level 3
Hi Greg, I looked into it and got to know that am not getting the Session_Id in the response of upload_session/start callout. So I tried hitting it with the following snippet:
return fetch('https://content.dropboxapi.com/2/files/upload_session/start', {"method": "post","headers": {"Authorization" : "Bearer "+dropboxToken,"Content-Type": "application/octet-stream","Dropbox-API-Arg": "{\"close\":false}"},"body": file}).then((httpResponse) => {console.log('Response:',httpResponse);if (httpResponse.ok){console.log("HTTP RES : OK")return httpResponse.ok} else {console.log("HTTP RES : NOT OK")return !httpResponse.ok}}).catch(err => console.log("[ERROR] UPLOAD_SESSION_FINISH : " + err));
And even after status code of 200 am not getting any Session_Id, This is the response am getting:- Response {type: 'cors', url: 'https://content.dropboxapi.com/2/files/upload_session/start', redirected: false, status: 200, ok: true, …}
- body: ReadableStream
- bodyUsed: false
- headers: Headers {}
- ok: true
- redirected: false
- status: 200
- statusText: "OK"
- type: "cors"
- url: "https://content.dropboxapi.com/2/files/upload_session/start"
- [[Prototype]]: Response
- arrayBuffer: ƒ arrayBuffer()
- blob: ƒ blob()
- length: 0
- name: "blob"
- arguments: (...)
- caller: (...)
- [[Prototype]]: ƒ ()
- [[Scopes]]: Scopes[0]
- body: (...)
- bodyUsed: (...)
- clone: ƒ clone()
- length: 0
- name: "clone"
- arguments: (...)
- caller: (...)
- [[Prototype]]: ƒ ()
- [[Scopes]]: Scopes[0]
- formData: ƒ formData()
- length: 0
- name: "formData"
- arguments: (...)
- caller: (...)
- [[Prototype]]: ƒ ()
- [[Scopes]]: Scopes[0]
- headers: (...)
- json: ƒ json()
- ok: (...)
- redirected: (...)
- status: (...)
- statusText: (...)
- text: ƒ text()
- type: (...)
- url: (...)
- constructor: ƒ Response()
- Symbol(Symbol.toStringTag): "Response"
- get body: ƒ body()
- get bodyUsed: ƒ bodyUsed()
- get headers: ƒ headers()
- get ok: ƒ ok()
- get redirected: ƒ redirected()
- get status: ƒ status()
- get statusText: ƒ statusText()
- get type: ƒ type()
- get url: ƒ url()
- Здравко3 years agoLegendary | Level 20
varunvyas5678 wrote:Hi Greg, I looked into it and got to know that am not getting the Session_Id in the response of upload_session/start callout. ...
Hi varunvyas5678,
Once succeeds, the session id is within response body as JSON text. Fetch it out from there. 😉 Take a look here (for example). Why don't you use the official SDK? 🤷
Hope this helps.
- Greg-DB3 years agoDropbox Staff
varunvyas5678 I see you're getting back a response with a 200 status code, which indicates the call succeeded, so as Здравко said, you'll need to read out the JSON from the response body to get the session ID. We do recommend using an official SDK whenever possible, as it will do most of the work for you. You can find the instructions for the official Dropbox JavaScript SDK here, for instance.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 4 minutes agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!