Skip to main content
Best Answer

Assign instructors to sessions or events [API]

  • 24 July 2024
  • 3 replies
  • 34 views

I am trying to add the instructor to the vILT session or Event through the API and want to run a script for the whole year's Schedule.

Assign instructors to sessions or events:

/course/v1/instructors/add

And the request Body is :

{

 "items":

   {

     "id": 0

   }

 ],

 "options": {

   "instructors":

     0

   ],

   "type": "string",

   "replace": true

 }

}

 

What should i insert Here.

 

Also, i get this response.Attached]

 

 

3 replies

Userlevel 5
Badge +1

I see that you found the body sample in the API docs, but I’m wondering if you missed that, when you click on “BODY SCHEMA” underneath it, it explains all the fields in more detail:

Hope this helps.

Hi Ian ,

I have inserted this, as the request body. Just have a look.

{
  "items": [
    {
      "id": 157
    },
    {
      "id": 158
    }
  ],
  "options": {
    "instructors": [
      {
    "user_id":13071,
    "firstname":"Kushal",
    "lastname":"Dhakal",
    "username":"kud@lp.com",
    "event_only":true
}
    ],
    "type": "event",
    "replace": true
  }
}

is here anything wrong, The response code is 200. But the Response body is : [Screenshot Attached.

]
 

Userlevel 5
Badge +1

The HTTP 200 response is, I suppose, a little misleading, but leaving that to one side, have you tried this? 

{
"items": [
{
"id": 157
},
{
"id": 158
}
],
"options": {
"instructors": [
13071
],
"type": "event",
"replace": true
}
}

I think the issue could well have been that you provided too much information about the instructor instead of just providing the ID itself as an integer within an array, per the body schema.

Reply