API calls to Dropbox - file naming
We're working with the API calls to gather student submissions. The goal is to automate the collection of signature assignments for over 220 courses.
Using GET /d2l/api/le/(version)/(orgUnitId)/dropbox/folders/(folderId)/submissions/(userId)/download we noticed that the zip file doesn't follow the naming convention set in d2l.Tools.Dropbox.FilenameFormatUser or d2l.Tools.Dropbox.FilenameFormatSingle. Has anyone had any luck with organizing/renaming files in a bulk download process? We'd like to name the files with the OrgDefinedID or something similar to obscure the student name.
Best Answer
-
Hello,
Although I am not addressing your specific question, I use another method to get submissions.
/d2l/api/le/(version)/(orgUnitId)/dropbox/folders/(folderId)/submissions/(submissionId)/files/(fileId)This returns a file stream of a single assignment submission. Once you have the stream, you save it to any filename you like so you have total control of the naming convention.
Note: Before saving check if the stream.Content is binary or string and save accordingly, i.e. write lines or write bytes.
You will need to first get a list of all dropbox folders
/d2l/api/le/(version)/(orgUnitId)/dropbox/folders/And then a list of submissions
/d2l/api/le/(version)/(orgUnitId)/dropbox/folders/(folderId)/submissions/This method is perhaps a bit more work but is totally flexible.
Hope this helps,