I am using services module and rest API its working fine.

But i need to create a menu callback where i get the json post data and save in database.

How to get the json data in menu callback?

  • Do you mean the POST data? It's in $_POST
    – Clive
    Jan 14, 2016 at 13:45
  • Yes you are right.
    Jan 14, 2016 at 14:55
  • You need to create a custom service resource, which in turn creates the necessary menu callback and will allow you to POST data to it. Here's an example: docs.drupalgap.org/7/Services/Create_a_Custom_Service/… Jan 14, 2016 at 16:08
  • Thanks @tyler.frankenstein for sharing the docs. I will check it and let you know. Actually i need to alter user registration response result(uid,uri). i need more field value instated of(uid and uri). Thats why i want to go for custom service. If i can alter the registration response. It will good for me. If there is any docs for alter the user registration response. Please share.
    Jan 15, 2016 at 6:14
  • I've answered the question to your follow up comment below, I'd recommend updating your question to match. Jan 15, 2016 at 14:42

1 Answer 1


Through comments, we determined the OP would like to alter the results of the user registration service resource...

To alter the results of user registration data, implement hook_services_request_postprocess_alter() in your custom module, for example:

 * Implements hook_services_request_postprocess_alter().
function my_module_services_request_postprocess_alter($controller, $args, &$result) {
  if ($controller['callback'] == '_user_resource_register') {
    $result->foo = 'bar';

This will allow the value of foo to be available to your application that is calling the user registration service resource.

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.