Brightspace API "Invalid Parameters"

Malte.W.235
Malte.W.235 Posts: 9 🌱
At a high level: I am trying to use the course-import endpoint to upload a SCORM package zip file.


In the weeds: I am able to hit other Brightspace APIs (including successfully authenticating) using Postman, but I am getting "400" errors when trying to import a course zip file using Brightspace's course-import API endpoint.


I'm hitting the endpoint here: https://docs.valence.desire2learn.com/res/course.html#post--d2l-api-le-(version)-import-(orgUnitId)-imports-

I configured Postman to use the "simple file upload" approach specified in the docs (earlier link as well as https://docs.valence.desire2learn.com/basic/fileupload.html#simple-uploads).


This is the response I'm getting:

{

    "type": http://docs.valence.desire2learn.com/res/apiprop.html#invalid-parameters,

    "title": "Invalid Parameters",

    "status": 400,

    "detail": "Request has missing or invalid parameters."

}

Are there any examples of how to properly make these calls?


 

Answers

  • Ian.P.710
    Ian.P.710 Posts: 27

    I use the below call with postman.
    {{BrightspaceDomain}}/d2l/api/le/{{leversion}}/import/{{orgunitid}}/imports/?callbackUrl="https://localhost:3000/oauthcallback".

    The callback url is the same as I use in postman for the oauth2 callback.

    The Body is set to Form data then I select the key as file the scorm file to be uploaded scorm.zip and type application/zip

    Hope it helps.

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

    @Ian.P.710 Could you post screen grabs of your Postman configuration or post it here in json?

    Else, could you compare to the screen grabs below?

    I changed a few things to match what you wrote, but I still get a 400


    only default postman-generated headers…


    key is "file" for the zip file

  • Ian.P.710
    Ian.P.710 Posts: 27

    I think the issue you might have is you are uploading to 6606 as the OrgUnitId this should be a course offeringid not the 6606. eg in my case 14500 is the orgunit of the course I am trying to upload too.

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

    @Ian.P.710 ARGHHHHH. I'm sure you're right. Thanks

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

    @Ian.P.710 The OrgUnitId is the ID of a course?

    I created a new course via the api and get back

    {
    "Identifier": "6765",
    "Name": "Ten Common Misconceptions",
    "Code": "tcnwmp",
    "IsActive": true,
    "CanSelfRegister": false,
    "Description": {
    "Text": "blahblah.",
    "Html": ""
    },
    "Path": "/content/enforced/6765-tcnwmp/",
    "StartDate": null,
    "EndDate": null,
    "CourseTemplate": {
    "Identifier": "6662",
    "Name": "Sample SCORM Content",
    "Code": "unbm4"
    },
    "Semester": null,
    "Department": {
    "Identifier": "6647",
    "Name": "xxx*",
    "Code": "xxxxx"
    }
    }

    So I used this new identifier (6765) in that import courses API… but I'm still getting a 400: {{brightspace_domain_url}}/d2l/api/le/{{le_version}}/import/6765/imports/?callbackUrl={{ucar_callback_url}}

    Is there any way to look at the logs and get the stacktrace, hopefully with details on which parameter(s) are missing or invalid?

  • Ian.P.710
    Ian.P.710 Posts: 27

    Hi Richard
    If you have access to the System Error Log as admin you might find some detail there. Also apart from the error 400 is there anything showing in the postman console?
    However you might at this point be better to raise a support case.

    Without doing a screen share at this point I am not sure I can figure out why it is not working.