I am trying to create a Room Reservations Reservation through a Service using the Node Creation resource, but looking at the Room Reservations module code, the module does not allow the creation of nodes, or the passing of the form data for that matters, unless specific parameters are passed as arguments in the URL.

So far I have tried using the node create resource with the following data formatted as JSON, to no success

{"title":"fulano de tal","type":"room_reservations_reservation","reservation_block_title":{"und":[{"value":"0"}]},"reservation_date":{"und":[{"value":{"year":"2016","month":"6","day":"1","hour":"10","minute":"0","second":"0"},"timezone":"America/Bogota","timezone_db":"America/Bogota"}]},"reservation_length":{"und":[{"value":"60"}]},"reservation_repeat_type":{"und":[{"value":"1"}]},"reservation_repeat_until":{"und":[{"value":{"year":"2016","month":"6","day":"1","hour":"10","minute":"0","second":"0"},"timezone":"America/Bogota","timezone_db":"America/Bogota"}]},"reservation_room":{"und":[{"value":"163"}]},"reservation_time":{"und":[{"value":"1000"}]},"reservation_series_id":"","field_codigo_reservation":{"und":[{"value":"654535184561"}]},"field_email_registro":{"und":[{"email":"[email protected]"}]}}

The response is the whole webpage and no node is created.

i think the solution here is to pass the required arguments so that Room Reservations creates the node, would something like the following work?


Along with the rest of the data in the JSON POST request.

1 Answer 1


1) Firstly you will create your custom resource for POST request. Add Below Code to your module file.

function Your_Module_Name_services_resources() {
     $resources = array();
     //Include the necessary inc files.
    module_load_include('inc', 'Your_Module_Name', 'includes/Your_Module_Name.services');

   //Service Apis for contents.
    $resources += Your_Module_Name_resource();
    return $resources;

2) Create Your_Module_Name.services.inc file and write below code for your custom callback as given below.

function Your_Module_Name_resource() {
  $api = array(
'applicant_validate' => array( // Resource Name
 'operations' => array(
    'create' => array(
    'help' => 'Validate Applicant',
    'file' => array(
        'type' => 'inc',
        'module' => 'your_module_name',
        'name' => 'includes/your_module_name.services',
    'callback' => 'your_callback_function_name',
    'access callback' => 'user_access',
    'access arguments' => array('access content'),
    'access arguments append' => FALSE,
    'args' => array(
        'name' => 'body',
        'type' => 'string',
        'description' => 'Function to perform',
        'source' => 'data',
        'optional' => FALSE,
        'default' => '0',
   return $api;

// variable name $body as you mentioned above in args part with name parameter

function your_callback_function_name($body) 
  // It's called when you will hit to your web service url from your from submission.


<h2>Validate Web Service</h2>
 <form id="frm" method="post" action="http://example.com/api/endpoint/applicant_validate">
 <input type="text" placeholder="Application Id" name="appno" id="appno"/>  
 <input type="text" placeholder="Email Id" name="emailid" id="emailid"/>
<input type="text" placeholder="Mobile Number" name="mobno" id="mobno"/>
<input type="text" name="userpwd" placeholder="Password" id="userpwd"/>
<input  type="submit" value="submit"/><br/>

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.