@nschwiet , I'm pretty sure I talked with you at a hack-day event at InstructureCon a couple of years ago. If I remember right, you were just starting out and thinking that you wanted to code in Python based off things you had seen. I didn't know anything about Python (still don't) and so we probably talked PHP more -- but that could be someone else.
Anyway, reading your problem, it looks like you've strayed away from the original intent -- perhaps because of the fine work @maguire is doing and because you're not sure of what you're doing or just because of a desire to learn more.
If you use the call that llawson mentioned, you can get the course ID by parsing some of the html_url properties. That API call should respond to the SIS codel, return the list of announcements with their IDs, and give you the course ID through a parse.
Here is a portion of what is returned when I make a call to my sandbox, which has some announcements.
GET /api/v1/courses/sis_course_id:sb_james/discussion_topics?only_announcements=1

The announcement ID is 1120683 and the course ID can be picked out by matching a regular expression on /courses\/([0-9]+)/ and then it's the first match.
You had originally stated that you wanted to remove all of the announcements. I'm not sure if that's what you're still after, but if that's what someone was trying to do, they wouldn't have to use the Announcements API at all, which means that you wouldn't need the course ID -- you could just use the sis_course_id and you don't have to mess with context ids at all, either.
You could then use the original API call you mentioned to delete the topics.
It seems you may be headed down a path of learning some really cool things, which seemed to be what was happening when we talked at InstructureCon. Sometimes it's cool to just absorb and I love doing that myself, especially if I can find someone willing to help. If you're just trying to delete the announcements, Parsa's answer was the one that you needed and then it's short trip to being done.