Assign or clear section course link
const url = 'https://example.com/wp-json/wp2/course-manager/v1/sections/1/course';const options = { method: 'PUT', headers: {'X-WP-Nonce': '<X-WP-Nonce>', 'Content-Type': 'application/json'}, body: '{"courseId":5}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://example.com/wp-json/wp2/course-manager/v1/sections/1/course \ --header 'Content-Type: application/json' \ --header 'X-WP-Nonce: <X-WP-Nonce>' \ --data '{ "courseId": 5 }'Sets _wp2lms_course_term_id via CourseSectionRelation::assign / unassign. Body courseId: null (or 0) clears the link. Requires WP2LMS. WP EDITABLE also accepts POST/PATCH.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Course term ID, or null/0 to unassign.
Example
{ "courseId": 5}Responses
Section titled “Responses”Updated link.
object
Examplegenerated
{ "ok": true, "sectionId": 1, "courseId": 1}Not authenticated.
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}Insufficient capability or invalid REST nonce.
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}Wp2cm_invalid_section_term / wp2lms_invalid_course_term
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}Wp2cm_course_link_unavailable
object
Machine-readable error or event code.
Message text (log, PIN, or password reset).
Extra WP_Error or license payload.
object
Examplegenerated
{ "code": "example", "message": "example", "data": {}}