I’m managing a LearnDash LMS on a WordPress site. For each new lesson, one of the teachers would publish a video (for exemple, on Youtube or Vimeo). I would then manually take the embed link for this video, create a dedicated lesson in an existing course, and put it in the content for students to watch.
Lately, I’ve been working on automating this process through Zapier.
I had to use LearnDash API v2, and everything was working as expected except that the created lesson won’t be “linked” to a course, even though I clearly specify the course id in the request.
Here’s what the call looks like:
The POST request is made to this endpoint
<website>/wp-json/ldlms/v2/sfwd-lessons
The headers are as follows (authentication headers are indeed excluded):
Content-Type: application/json
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0
The body:
{
"title": "Course title",
"content": "Embed link",
"course": Course-ID,
"status": "publish",
"menu_order": 1
}
Each of these attributes is taken into account except “course”.
- I also tried the exact same request through Postman, with the exact same results.
- Everytime, in the response body, it is shown
"course": 0
. - I’ve tried with several Course-IDs, hard-coded or not, but I still can’t figure out why it doesn’t work or if I’ve missed an important step to make the lesson linkable somehow.
- The only way to date to link a lesson I create through this API is to do it manually through the LMS Dashboard, which is a pity compared to the original aim.
Many thanks to the kind souls who will pass by to help me with this issue.
Rayane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.