Send object into existing array PUT request

System Information
  • Strapi Version: 3.6.3
  • Operating System: Ubuntu 18.04
  • Database: MongoDB
  • Node Version: 14.15.4
  • NPM Version: 6.14.10
  • Yarn Version: 1.22.10

I have 2 Content-Types, Lesson and Course. Lesson type have 2 fields title and content, both are short-text. Course has many fields and one of the field is relationship: Course has many Lessons.
I am trying to make a PUT request to /courses/id endpoint to add lessons something like this:
const res = await fetch(${baseUrl}/courses/${course.id}, {
method: “PUT”,
headers: {
Authorization: Bearer ${token},
},
body: JSON.stringify({ lessons: values }),
});
const result = await res.json();

response status code is 200, but it doesn’t add lesson.
How to do this? If you any need any other information please do let me know I will provide it here.
Thank you

1 Like