AnsweredAssumed Answered

Delete announcements via API

Question asked by Nick Schwieterman on Apr 3, 2017
Latest reply on Apr 21, 2017 by Nick Schwieterman

I am attempting to delete announcements via an API call. I have a PHP script that allows me to pull a list of courses from a csv file. From that list of courses, I would like to make an API call that deletes all announcements. From the API documentation, it seems like I the call I would need to make is 

DELETE /api/v1/courses/:course_id/discussion_topics/:topic_id

 

However, I would first need to know which topic_ids are announcements. That being the case, would I first need to pull a list of all announcements, and filter out only announcements via the following with the parameter only_announcements set to true?

GET /api/v1/courses/:course_id/discussion_topics

 

If I do this, I'm guessing I would need to store these results in an array and then make the delete call after that.

 

Coding is not my primary area of training, so I might be missing something basic here. If anyone has any thoughts or suggestions, or example code of similar operations, this would help greatly.

 

Thanks!

Nick

Outcomes