What is the proper URL to get flag service?
I had to implement this for DrupalGap/jDrupal:

https://github.com/dontmcyn/flag/blob/master/flag.js#L282

Essentially you make a POST to ?q=rest/flag/countall.json and send along the following data:

var data = {
  flag_name: 'my_flag_name',
  entity_id: 123
}


You may have to JSON.stringify(data) before sending it. And you are right, pass along an X-CSRF-Token header in the POST call, the value of the token can be retrieved here: ?q=services/session/token