Skip to main content

When calling POST /course/v1/courses/{course_id}/sessions

payload as 

{
"name": "session-2-2",
"code": "sea2-2",
"description": "test api session",
"min_enroll": 0,
"max_enroll": 20,
"evaluation_type": 3,
"instructors": :{

"id": 13269,
"firstname": "Jennifer",
"lastname": "Davis",
"username": "jennifer.davis"

}]
}

It returns error: 

{
"name": "Bad Request",
"message": "
"Invalid parameter: instructors"
],
"code": 1002,
"status": 400
}

Could you let me know what is correct instructors input?

Going off the API-Browser’s documentation, the payload should look like this for the endpoint and considering the field parameters you posted:

POST /course/v1/courses/{course_id}/sessions

 

{
"instructors": "
13269
],
"name": "session-2-2",
"code": "sea2-2",
"description": "test api session",
"min_enroll": 0,
"max_enroll": 20,
"evaluation_type": 3
}

Testing in my trial platform I have received a 200 response (although I swapped out a course ID and user ID for ones that exist in my platform).

From the Course > Session page, I can see the new Session and Instructor assigned:

 


Yup, above is how I do it, its an array of the docebo id’s of the instructors. The format you have in the above looks more like the GET response than the POST submission.


@Bfarkas you are right! I posted in part code and in part screen shot. Here’s the full breakdown:

Request URL:

POST https://yourdomain.docebosaas.com/course/v1/courses/93/sessions

Payload:

{
"instructors": s
13269
],
"name": "session-3-3",
"code": "sea3-3",
"description": "test api session 3",
"min_enroll": 0,
"max_enroll": 20,
"evaluation_type": 3
}

Response:

{"data":{"id_session":36},"version":"1.0.0","_links":k]}

From Chrome console:

 


I am still getting same error. I have checked the course which is classroom and used same payload 

{
"instructors":
13269
],
"name": "session-3-3",
"code": "sea3-3",
"description": "test api session 3",
"min_enroll": 0,
"max_enroll": 20,
"evaluation_type": 3
}

in postman. The different is host url. Any idea?

 


Hmm, nothing is jumping at me, you are positive the 13269 is a valid active user in your instance?

Random question/thought, you are making a new session right, not updating an existing?


@Bfarkas , 

Your thought is right. Even that the status shown as “1” in response from /manage/v1/user, it does not work until I go to UI to activate the user manually. 

Thanks both you @John and @Bfarkas to point me right direction.


cool, glad you got it sorted!


Reply