Course import using Brightspace API (and Postman)

Options
Richard.R.305
Richard.R.305 Posts: 20 🌱
edited July 2023 in Development

— cross-posting; also posted in Developers group forum —

Hi, I am trying to use the "Create a new course import job request" api:  https://docs.valence.desire2learn.com/res/course.html#post--d2l-api-le-(version)-import-(orgUnitId)-imports-

Has anyone successfully used this API endpoint using Postman?

I'm using Postman 10.15.4. My API call authenticates but after a few seconds (evidently after the transfer of the zip file), I get a 400 - bad/missing parameters - response.

Any help or pointers would be appreciated. Or if this is not the correct place for these questions? (I've looked at the "simple file upload" doc, but still not sure about the headers.)

(I'm working on what will eventually be a stand-alone service that automates uploading SCORM packages to Brightspace, fyi)


Here are my Postman settings:
{
"info": {
"_postman_id": "99f4aa69-7318-4db9-a746-8c1eba2244e5",
"name": "UCAR",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "12949045"
},
"item": [
{
"name": "import",
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"content-type": true
}
},
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "redirect_uri",
"value": "",
"type": "string"
},
{
"key": "clientSecret",
"value": "blahblah",
"type": "string"
},
{
"key": "clientId",
"value": "blahblahblah",
"type": "string"
},
{
"key": "accessTokenUrl",
"value": "https://auth.brightspace.com/core/connect/token",
"type": "string"
},
{
"key": "authUrl",
"value": "https://auth.brightspace.com/oauth2/auth",
"type": "string"
},
{
"key": "useBrowser",
"value": false,
"type": "boolean"
},
{
"key": "scope",
"value": "import:job:create",
"type": "string"
},
{
"key": "addTokenTo",
"value": "header",
"type": "string"
},
{
"key": "headerPrefix",
"value": "Bearer",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "multipart/form-data; boundary=xxBOUNDARYxx",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "--xxBOUNDARYxx",
"value": "",
"type": "text"
},
{
"key": "Content-Disposition",
"value": "form-data; name=\"file\"; filename=\"BlahBlahUploadFile.zip\"",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/zip",
"type": "text"
},
{
"key": "",
"type": "file",
"src": "/Users/richardrussell/Downloads/BlahBlahUploadFile.zip"
},
{
"key": "--xxBOUNDARYxx--",
"value": "",
"type": "text"
}
]
},
"url": {
"raw": "",
"protocol": "https",
"host": [
"lms",
"meted",
"ucar",
"edu"
],
"path": [
"d2l",
"api",
"le",
"1.70",
"import",
"6606",
"imports",
""
],
"query": [
{
"key": "callbackUrl",
"value": "https://mySite/callback"
}
]
},
"description": "import"
},
"response": []
}
]
}

Richard

https://docs.valence.desire2learn.com/res/course.html#post--d2l-api-le-(version)-import-(orgUnitId)-imports- https://mySite/callbackhttps://mySite/d2l/api/le/1.70/import/6606/imports/?callbackUrl=https://mySite/callback

Tagged:

Answers

  • LaTia.D.893
    LaTia.D.893 Posts: 2 🔍
    Options
    No I haven’t.
  • Ian.P.710
    Ian.P.710 Posts: 25
    Options

    Hi Richard

    I would say not to do this as the Scorm should be added to the SCORM/Xapi player, currently there are no available api's to upload to this but you can bulk upload upto 50 scorm or 2GB of files via drag and drop in the UI.



  • Richard.R.305
    Richard.R.305 Posts: 20 🌱
    Options

    @Ian.P.710 We are trying to migrate 1,000-plus courses into Brightspace.

    Does D2L / Brightspace have any other suggestions on how to do this programmatically, rather than bulk-uploading 50-at-a-time?

    Thanks

  • Ian.P.710
    Ian.P.710 Posts: 25
    Options

    Hi Richard
    Are you just looking to upload scorm that can then be added to a Brightspace course or is it a course export from a different LMS.
    Do you know if you have a D2L Technical Account Manager or are you in implementation?
    If you have a Tam I would suggest reaching out to them.

  • Richard.R.305
    Richard.R.305 Posts: 20 🌱
    edited July 2023
    Options

    It is a course export from a different system - we are trying to move everything into Brightspace. The course is first converted to SCORM format (before trying to import into Brightspace).

    There are two paths: create and modify. Right now there are no courses in Brightspace. I was thinking I would create the Brightspace course (programmatically, via an API) and then presumably associate uploaded SCORM file(s) to this newly created course. For modified content, i.e. once the course exists, then we replace content with a new SCORM file. Hopefully that makes sense.

    I'm checking re: a technical account manager.

    Any suggestions are welcome.

  • Richard.R.305
    Richard.R.305 Posts: 20 🌱
    Options

    Just to add…

    We are into implementation. Previously we had a Strategic Project Manager and an Implementation Consultant but they also said that the best way to communicate with the D2L/Brightspace team that builds the API is through the Community Pages. We can try to put in a ticket, but like I said, previously we were told to turn to this community.

  • Ian.P.710
    Ian.P.710 Posts: 25
    Options

    Hi Richard
    So as you are importing a full course from another LMS, I would suggest you speak to the implementation consultant and see if there is a different solution to this issue.
    D2L has a bulk course import that can be done by Implementation based on standard course exports for some other LMS vendors.
    This way you are treating the packages as a course and not a scorm package.

    That said in Postman I used this POST {{BrightspaceDomain}}/d2l/api/le/{{leversion}}/import/{{orgunitid}}/imports/?callbackUrl="https://localhost:3000/oauthcallback"
    In to a empty course shell to upload a scorm file, but as I said I do not recommend that you do it this way.
    You should select the scorm file via select files and once it is uploaded you should receive a Job Token which the status can be checked with the GET {{BrightspaceDomain}}/d2l/api/le/{{leversion}}/import/{{orgunitid}}/imports/{{jobToken}}

    the response will look like {    "JobToken": "324",    "TargetOrgUnitId": 14300,    "Status": "PROCESSING"}