How to get unread notification / topic count via API?

A clean howto on how to use those api endpoints? or how to use cookie/session to make authenticated JavaScript CORS requests (doable, but way more involved)?