Error 400 when posting a new topic and file to Brightsapce API

Asked
Active3 hr before
Viewed126 times

4 Answers

error
90%

Everything looks to be working as per the documentation but I always receive a "Request has missing or invalid parameters" I cannot see what parameter I might be missing?,Using PHP with guzzle I am attempting to post a new topic with file to the the Brightsapce API as per https://docs.valence.desire2learn.com/res/content.html#post--d2l-api-le-(version)-(orgUnitId)-content-modules-(moduleId)-structure-, Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers , By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Using guzzle streams I have built the request which looks like this.

--xxBOUNDARYxx

content - type: application / json

Content - Disposition: form - data;
name = ""

Content - Length: 223

{
   "Title": "Placeholder, Please Delete",
   "ShortTitle": "",
   "Type": 1,
   "TopicType": 1,
   "Url": "\/content\/enforced\/376743-TKS101_TRI-3_2014\/test.html",
   "StartDate": null,
   "EndDate": null,
   "DueDate": null,
   "IsHidden": false,
   "IsLocked": false
}

--xxBOUNDARYxx

content - type: text / html

Content - Disposition: form - data;
name = "";
filename = "test.html"

Content - Length: 477

   <
   !DOCTYPE html >
   <
   !--
   ...
load more v
88%

An action consists of an HTTP method (most commonly GET, POST, or DELETE). The general structure of the URL provided with this method looks like this:,Brightspace APIs provide a REST-like interface to third-parties for interaction over HTTP with back-end Learning Service providers. This topic covers the basic calling conventions for the API: how to make requests of the API and what to expect back from the service in response.,The host name for the LMS deployment. This will typically be set by the organization that your application is connecting to.,The authentication system requires callers to create the signature result tokens before encoding them as parameters in URLs: see the authentication topic for more details on how to do that.

{
   "Identifier": "2046",
   "FirstName": "Jodi",
   "LastName": "Singh",
   "UniqueName": "jodi.singh",
   "ProfileIdentifier": "ixCgsUKx1I"
}
load more v
72%

One thing you can do to verify the issue is a server-side issue is to try loading the website on different browsers. If you want to go the extra mile, test it on an entirely different machine/device to rule out system-specific problems.,A 400 Bad Request can also occur when you try to upload a file to a website that’s too large for the upload request to be fulfilled. This is strictly related to the file size limit of the server and will vary based on how it has been set up.,If you’re trying to upload a file to a website that’s exceeding the server file size limit, you’ll encounter a 400 Bad Request error.,The 400 Bad Request can happen when the DNS data stored locally is out of sync with registered DNS information.

This is surprisingly easy to do by mistake and can happen if a URL has been encoding incorrectly. The following link is an example of a URL containing characters the server won’t be able to process, hence a 400 Bad Request error is triggered.

https://twitter.com/share?lang=en&text=Example%20of%20malformed%%20characters%20in%20URL

https: //twitter.com/share?lang=en&text=Example%20of%20malformed%%20characters%20in%20URL
load more v
65%

I have the LTI connecting and loading an HTML page with a button that fires off this function:, Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. ,What is your Moodle's version?

function SendGrade() {
   const Http = new XMLHttpRequest();
   const url = 'https://www.myMoodleURL/grade?ltik=' + ltik;
   Http.open("POST", url);
   Http.send();
}
load more v

Other "error-undefined" queries related to "Error 400 when posting a new topic and file to Brightsapce API"