API Question - Automatic upload of an externally created 4MB JSON File to "Org files" each night

Richard.Stephens6486
edited November 2022 in Development

I have an external (to Brightspace) automated overnight batch process that outputs a single JSON file (approx. 4MB). I would like the JSON file to be automatically uploaded into Brightspace (Content folder in the main Organisational Files) replacing yesterday's file. The JSON is used by a custom Widget and currently this "upload" is being done manually (delete old file, then drag and drop new file) early each morning.

 

My question: Could this process be automated with the API and if so - thoughts on how best to achieve this?

 

Many thanks for reading / any reply. 

 

Kind regards, 

 

Richard

Tagged:

Answers

  • Scotty.Robinson5392
    edited November 2022

    @Richard Stephens​ - Hi Richard! Thanks for posting on Community. I'm going to have to do some research into this one with some internal resources. I'll get back to you as soon as I have more information.

     

    In the meantime, we have a Developers group right here in Community where API is a big topic of conversation - you may want to cross-post your question there and see if your peers have any input for you!

     

    Group URL:

     

    https://community.brightspace.com/s/group/0F9610000001mZ1CAI/developers

  • Scotty.Robinson5392
    edited November 2022

    @Richard Stephens​ - Good morning, Richard - here is what I heard back from our internal API specialist:

     

    Not 100% sure if it will work. But you can experiment with the Content Topic creation API and see if you can make it upload a file to that location. If you use the same location it can overwrite. You will need to make a module first then add topic. Might want to delete the module/topic when the file upload is done.

     

    Maybe you can make a new OU and set its Path via the Org Unit Editor to what you like and then upload files to that OU as Content Topics. But I am a little worried about access restrictions for people not enrolled in that OU so that is something to test out.

     

    If the people who need to use the widget can't access the data then this idea is out.

     

    https://docs.valence.desire2learn.com/res/content.html#post--d2l-api-le-(version)-(orgUnitId)-content-modules-(moduleId)-structure-

  • Richard.Stephens6486
    edited November 2022

    Hi Scotty,

     

    Many thanks for your replies and the suggestions.

     

    I'll investigate...

     

    Kind regards,

     

    Richard.

  • Scotty.Robinson5392
    edited November 2022

    @Richard Stephens​ - one more piece of information came in that I'd like to relay:

     

    We have a service that is doing this, it leverages an API call to write a file into org files - it uses the following API calls:

    1. POST /d2l/api/le/{version}/6606/content/root/
    2. POST /d2l/api/le/{version}/6606/content/modules/{moduleid}/structure/
    3. DELETE /d2l/api/le/{version}/6606/content/modules/{moduleid}

     

  • Richard.Stephens6486
    edited November 2022

    Hi Scotty,

     

    Thanks again for all your assistance - this sounds hopeful.

     

    A further query (if you have time?): I would like to do this using your Python client library as a Python program will easily attach to the end of my existing batch process.

     

    https://docs.valence.desire2learn.com/clients/python/index.html

     

    Do you see any issues combining your latest suggestions and this library?

     

    Kind regards,

     

    Richard