Using Picker's Asset replace mode you can replace a file that was uploaded earlier. In order to use this mode, you'll need:-
- ID of the file you want to replace
uploadKeyto initialize the PickerserviceTokento open Picker in replacement mode
How to get the ServiceToken
serviceToken is a short-lived token that must be retrieved using a API call to FileSpin Service. Call the API by supplying your API_KEY and scope=EDIT_ASSET parameter. cURL example is shown below:-
curl -X "GET" \
"<<API_HOST>>/api/v1/authentication/service_token?scope=EDIT_ASSET" \
-H "X-FileSpin-Api-Key:API_KEY"Using ServiceToken in Picker for replacing a file
The following code sample shows how to use ServiceToken to start a file replace.
FileSpin.initPicker({
uploadKey: "UPLOAD_KEY",
serviceToken: "SERVICE_TOKEN",
fileToReplaceId: "REPLACEABLE_ASSET_ID",
});