Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7931079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:37:15+00:00 2026-06-03T20:37:15+00:00

I have a basic Valence App build for Desire2Learn and now I’m trying to

  • 0

I have a basic Valence App build for Desire2Learn and now I’m trying to POST data and I either get a 400 or 404 error.

If I make a GET request
to /d2l/api/le/(D2LVERSION: version)/(D2LID:
orgUnitId)/content/root/, with the correct orgUnitId, I can see all of the
content for a course. However, when I POST a
ContentObjectData of
type Module, it returns a 400. The docs have nothing listed for a 400
error for that particular request, but I’m assuming that I messed up the
ContentObjectData. I’ve tried multiple times, but it always results in a
400. The JSON block looks like this:
{
“Title”: “API Test”,
“ShortTitle”: “”,
“Type”: 0,
“ModuleStartDate”: null,
“ModuleEndDate”: null,
“IsLocked”: false,
“IsHidden”: true
}

If I make a GET request
to /d2l/api/le/(D2LVERSION: version)/(D2LID:
orgUnitId)/content/modules/(D2LID: moduleId)/structure/, with the correct
orgUnitId and moduleId, I can see the module’s content. When I
POST a
ContentObjectData of type Topic, it returns a 404. I’m doing this in
Python, which there is no sample SDK code given, so I converted the PHP
one.

I’ve been using another JSON
block with a key ‘Url’ and then the respective value. Here’s the fully
encoded multipart body I’ve been trying to POST:

    --redacted.132.0.68062.1336325296.611.1
    Content-Disposition: form-data; name="ContentObjectData"
    Content-Type: application/json

    {"StartDate": null, "IsLocked": false, "TopicType": 3, "ShortTitle":
"", "Title": "API Test", "Url": "http://redacted.edu",
"EndDate": null, "IsHidden": true, "Type": 1}
    --redacted.132.0.68062.1336325296.611.1
    Content-Type: application/json

    {"Url": "http://redacted.edu"}
    --redacted.132.0.68062.1336325296.611.1--

Why would the same URI for GET and POST result in a 404 just for POST? It
doesn’t look like the structure is any different between the two calls in
the docs. I tried this call as a normal POST request and as the multipart,
but both result in a 404. I’ve tried both of these calls using 3 different
users, one which has full admin privileges.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:37:21+00:00Added an answer on June 3, 2026 at 8:37 pm

    This seems like two different questions, one about the route /d2l/api/le/{ver}/{orgUnitId}/content/root/ and one about the route /d2l/api/le/{ver}/{orgUnitId}/content/modules/{moduleId}/structure/. I’ll try to address these separately:

    Adding a root module. The first route gets used to add a route module to an org unit’s content repository. The route has particular restrictions around the “Title” and “ShortTitle” properties: both must be non-null, and non-empty. In addition, the ShortTitle property must be in a form that can’t be “trimmed” down to the empty string (for example, it can’t be a string that has nothing but white-space in it). The slightly different restrictions on these strings has been recognized as an inconsistency, and a more regular approach may be forthcoming in a future release. You’re safe if you take the approach that you must provide a title and short title for new root modules.

    Adding a topic to an existing content structure. The second route gets used to add to an existing module’s structure in an org unit’s content repository. The way you use the route varies depending on whether you want to add a URL or whether you want to add a file.

    To add a topic that’s nothing more than URL, you need provide only the first part of the multipart/mixed POST (and in fact, you can just send a single POST body) with the application/json type:

    {
       "Title": "Test link topic title",
       "ShortTitle": "Link",
       "Type": 1,
       "TopicType": 3,
       "URL": "http://fqd.url.to.resource.com/",
       "StartDate": null,
       "EndDate": null,
       "IsHidden": false,
       "IsLocked": false
    }
    

    Note that: (a) your topic must have a short title–in fact, the topic data block has the same restrictions around Title and ShortTitle properties as in the first question above; and, (b) you don’t need to provide a second part containing the URL only.

    To add a topic that’s a file, you provide a similar JSON block as the first part of your multipart/mixed POST body, but (a) the TopicType should have the value ‘1’ to indicate the topic is a file, (b) the URL property should point to a valid location URL to within the org unit’s existing content space (this is how the back-end service knows where to store the file), and (c) the second part of the POST should contain the file data. Your POST body will end up looking something like this:

    POST https://yourlms.edu/d2l/api/le/{ver}/{orgUnitId}/content/modules/{moduleId}/structure/?{auth} HTTP/1.1
    Content-type: multipart/mixed; boundary=FOO
    Content-length: {length}
    
    --FOO
    Content-type: application/json
    {
       "Title": "Test file topic title",
       "ShortTitle": "File",
       "Type": 1,
       "TopicType": 1,
       "URL": "http://fqd.url.to.resource.com/",
       "StartDate": null,
       "EndDate": null,
       "IsHidden": false,
       "IsLocked": false
    }
    
    --FOO
    Content-Disposition: form-data; name=""; filename={filename}
    Content-Type: {file's content type}
    
    {binary data}
    

    Currently, the Valence reference docs do not clearly distinguish between these two kinds of requests, and they will soon be updated to do so.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have basic authentatication working with REST API using curl: curl -X POST -H
Right now, I have basic code for moving the textfield above the keyboard when
I'm using node, express and connect for a simple app and have basic HTTP
I have basic client-side validation working in my MVC3 RC2 application, but I'm now
I have basic idea on Kilo Virtual Machine on Mobiles , I have clear
I have basic hello word example of Prime Faces. I have created dynamic web
I have a basic class that derived subclasses inherit from, it carries the basic
I have a basic question, in the Django template language how can you tell
I have the basic code to rewrite a subdomain to another page. But how
I have a basic has_many :through relationship that is bi-directional: calendars have many calendar_calendar_events

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.