1

We're trying to import class content from our LaunchPad to Desire2Learn in a particular module. Here is what we think needs to happen:

  1. Create a link.

POST to /d2l/api/le/1.3/lti/link/6720 with 6720 being the org ID, which returns the link ID.

This is successful.

  1. Create a quick link.

POST to /d2l/api/le/1.3/lti/quicklink/6720/228 with 228 being the link ID from above.

This is successful.

  1. Create a link topic.

POST to /d2l/api/le/1.3/6720/content/modules/638/structure/ with 638 being the parent module ID obtained from LTI parameter custom_links_import_service_url, query string parameter parentNode, and using the PublicUrl in the response from the quick link call.

This results in a 404, which per the documentation, suggests a OU or parent module ID issue.

I appreciate any help with this. I can't find any good developer how-to guides in the documentation, just the API reference.

I have tried other advise here in stackoverlow and they have not helped, for example: desire2learn api adding content 404 Posting Content to Desire2Learn 404 Error when trying to post a file topic

Community
  • 1
  • 1
  • Is your org unit ID, `6720`, that you're using for these calls also the value of the `context_id` LTI property in the launch from which you're harvesting the `custom_links_import_service_url` and its `parentNode` query string parameter? – Viktor Haag Jan 15 '14 at 20:06

1 Answers1

0

This particular call seems to enforce content-type of application/json. All other API POSTs I've been using are ok with text/plain. It is just this route (so far) that throws an error.

(I'm not sure a 404 is the proper error for this, either.)

Thanks, Viktor for your comment, and yes, both the route and the other parameters from the LTI parameters were correct.

  • It's good that you've figured out the issue; and thank you for the feedback around that call. Some calls may be able to cope with a JSON part that's not explicitly typed as `application\json`, but others are not able to cope. To be safe, you should always type JSON parts (either whole body, or multi-part body parts) as `application\json`. – Viktor Haag Jan 15 '14 at 21:44
  • As to _why 404_, this is a good point, and is likely an idiosyncrasy of the back-end service implementation. If an error occurs in the web-service's attempt to accept the parameters of your request and bind them to data objects to pass down to a handler in the underlying service-handling layer, then this can cause the web-service to react as if it cannot find a handler, which will result in a 404 Not Found error. – Viktor Haag Jan 15 '14 at 21:47