I'm running Drupal 7 with the Services module and the Flag Service modules installed but I'm having trouble trying to figure out how to Get countall for a particular post ? Can anyone please tell me what URL I should use ?

URL to get all posts : http://webaddess/rest/events

URL to get one Post : http://webaddess/rest/node/3591

  • I managed to find URL but getting this error : 406 Not Acceptable : There is no flag with node I am doing POST with this URL : website.com/rest/flag/countall Header : Content-Type: application/json x-csrf-token: token Body : { "flag_name":"content_favorite", "content_id":"3591" }
    – Malik Mati
    Commented Sep 17, 2015 at 15:44

1 Answer 1


I had to implement this for DrupalGap/jDrupal:


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

  • not sure how to use JSON.stringify(data) ? If you can explain it I will really appreciate it ?
    – Malik Mati
    Commented Sep 18, 2015 at 10:47
  • lmgtfy.com/?q=JSON.stringify ;) Commented Sep 18, 2015 at 14:10
  • Thanks :) But I did that before asking you. Actually I am very beginner
    – Malik Mati
    Commented Sep 18, 2015 at 19:25
  • It all depends on what "type" of JavaScript you are doing to make the call (XMLHttpRequest, jQuery.ajax, etc). But in most cases you just do var data = JSON.stringify({ flag_name: 'my_flag_name', entity_id: 123 }); Commented Sep 20, 2015 at 1:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.