Skip to main content

Posts

Showing posts from 2015

Apache solr query from custom module !

    $solr = apachesolr_get_solr();     $role_to_search = 4;     $query = array('q'=>'entity_type:user AND ts_role:'.$role_to_search);     $params = array(         'start'=>0,         'rows'=>5,         'fl'=>array('label','entity_id','sm_image_uri_field_user_image')     );     return $solr->search($query,$params);

Check validity of one time login url by Drupal 7 Services module?

Create mytut_service.info and put following code in file. I am assuming you know how to create module. name = Mytut service description = My custom Service. package = Other core = 7.x dependencies[] = services dependencies[] = rest_server Put following code in mytut_service.module file. function mytut_service_services_resources() { $api = array( 'mytut_service_service' => array( 'operations' => array( 'retrieve' => array( 'help' => 'Retrieves story by nid', 'callback' => 'mycallback', 'access callback' => 'user_access', 'access arguments' => array('access content'), 'access arguments append' => FALSE, 'args' => array( array( 'name' => 'fn', 'type&

Creating custom Web Service along with passing parameters Drupal 7

Put the following code in .module file. And enable this module, i am assuming you know how to create module. function mytut_service_services_resources() { $api = array( 'mytut_service_service' => array( 'operations' => array( 'retrieve' => array( 'help' => 'Retrieves story by nid', 'callback' => 'mycallback', 'access callback' => 'user_access', 'access arguments' => array('access content'), 'access arguments append' => FALSE, 'args' => array( array( 'name' => 'fn', 'type' => 'string', 'description' => 'Function to perform', 'source' => array('path' => '0'), '

Register user with profile fields using services module

This json format worked for me creating user with profile2 term reference fields in which multiple selection can be done. Below  profile_student_profile is term reference field with multiple selection. { "name":"oiu", "mail":"oiu@aol.com", "field_mobile_number":{ "und":{ "0":{ "value":"987393" } } }, "pass":"adsa", "field_requirement":{ "und":{ "0":{ "value":"vzxvczx" } } }, "field_gender":{ "und":"female" }, "field_class":{ "und":[ "12" ] }, "field_area":{ "und":[ "31" ] }, "status":1, "field_preferred_fee"