I'm playing witth Box API and was trying to get downscoped token for a file (based onhttps://developer.box.com/docs/downscope-tokens), This what I tried:
// Define resource and scopes that downscoped token should have access to// Define resource and scopes that downscoped token should have access to
val resource = "https://app.box.com/file/" + FILE_ID
val scopes = new ArrayList[String]
scopes.add("base_preview")
scopes.add("item_download")
// Perform token exchange to get downscoped token
val downscopedToken: ScopedToken = api.getLowerScopedToken(scopes, resource)
But then get the following error:
Exception in thread "main" com.box.sdk.BoxAPIResponseException: The API returned an error code [400] invalid_resource - The target resource is invalid.
at com.box.sdk.BoxAPIResponse.(BoxAPIResponse.java:92)
at com.box.sdk.BoxJSONResponse.(BoxJSONResponse.java:32)
at com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:582)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:354)
at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:329)
at com.box.sdk.BoxAPIConnection.getLowerScopedToken(BoxAPIConnection.java:721)
at box.GetDownscopedTokens$.main(GetDownscopedTokens.scala:30)
at box.GetDownscopedTokens.main(GetDownscopedTokens.scala)
What is the expected resource should look?