As well as uploading files to your workspace in the UI, files can be easily uploaded via an API.
Generating an upload token
An upload token can be generated from the workspace. From anywhere in the workspace, click the '+' tab and select 'Upload via API'. This will take you to a view showing any existing tokens and a form to create new tokens.
Creating a new token
Choose the valid period for your new token – the default is the maximum which is 30 days. Set a reason for the token and click 'create'. Click 'Confirm' when the dialogue box is shown. Your new token will be shown in the table.
Use the 'copy' button to copy your token to your local clipboard.
Note: the copy function is only available at the time the token is generated. If you navigate away from their view and come back, you may not be able to copy the token and will have to generate a new one.
Understanding the token format
The token will appear in this format:
- inboxid – will specify the location of the inbox
- wsid – will specify the workspace id the token is associated to
- tid – is the token id number applied
- date, valid_to, valid_from – are dates applied to the token check for validity
- token – is the token value supplied by Azure.
Using an upload token
Your upload token can be used to upload items to your workspace Inbox via a number of avenues.
Upload via AzCopy
Microsoft provides a service called AzCCopy which can be used to upload artefacts to Blob storage. Documentation to use this process is available.
The software is downloadable from the Microsoft website. To use AzCopy with workspaces, follow the instructions from Option 2: Use a SAS token
To run AzCopy on your own machine, navigate to the location where you have installed AzCopy and run the following command using the items from the token above.
azcopy copy "path/file" "token" --recursive
so for example:
azcopy copy "C:\local\path\myFiles" "https://inbox.inbox.org.blob.core.windows.net/tokenid" --recursive=true
The first parameter ("C:\local\path\myFiles") is the location of the files/folders you are attempting to upload. The second parameter ("https://inbox.inbox.org.blob.core.windows.net/tokenid") is the token that you have copied out of the workspace and the attribute 'recursive=true' informs AzCopy that it is a directory you are trying to upload and will upload any sub files and folders – this can be left off the command if you are uploading a single file.