I'm running Drupal 7 with the Services 3 and the Flag Service modules installed. I'm having trouble trying to figure out how to format the the call in REST format. Can someone provide a short example?

  • 1
    Actually this pertains to any non CRUD bases REST server request. I can't find documentation on how test the Voting API Service, the Flag Service or the Push Notifications Service.
    – user379468
    Sep 8, 2012 at 15:48

1 Answer 1


The flag service module (and probably the others you've listed in your comments) define their resources as actions, so you access them at a URL like:


So for the flag action provided by the flag module that would be something like:


This little snippet works well for me, based on a REST server with no authentication turned on and an endpoint with the path 'api':

$url = 'http://server-name/api/flag/flag.json';

$args = array(
  'flag_name' => 'bookmarks',
  'content_id' => 8,
  'action' => 'flag',
  'uid' => 1,

  // You wouldn't normally want this, the flag module provides it as an override 
  // but it's a security risk. With proper authentication you can safely remove it.
  // I'm just using it for testing.
  'skip_permission_check' => 1 

// Perform the curl
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($curl, CURLOPT_POST, 1); 
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($args));

$response = curl_exec($curl);

$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);


if ($http_code == 200) {
  // Success

Answering the original question (What is the proper format for the flag service calls?), it's simply a matter of calling the correct URL and POSTing the required arguments to it, from whatever programming language you might be using.

  • this totally worked for the flag server, I've had a trouble with the other two, but I attribute that to the module (both being dev versions, thanks
    – user379468
    Sep 11, 2012 at 14:42

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.