i am using drupal 6 and services 6.3x module but i am unable to use this module completely. I have enabled rest server module also. I added a new service and added resources to it. I added node resource to it and i am able to fetch all the nodes in json format

what i am not able to understand is :-

  1. The exact uri or may be the procedure to call getTree method in taxonomy_vocabulary resource

  2. How to acccess all the methods (CRUD) functions under every resource enabled

  3. The url -> mydomain.com/service/rest/node.json works for me but how can i access the getTree method ??

I am stuck on this like forever i have even posted jobs on the drupal site but i guess there are very rare people who have knowledge about this.

Edit :-

Live link is http://delvelogic.com/merchant/drupal-6.22/services/rest/taxonomy_vocabulary

The following is the java code i am using :-

    DefaultHttpClient httpClient = new DefaultHttpClient();
    HttpResponse response = null;  
    HttpPost postMethod = new HttpPost("http://delvelogic.com/merchant/drupal-6.22/rest/taxonomy_vocabulary/getTree.json");
    postMethod.addHeader("Content-type", "application/x-www-form-urlencoded");
  //  postMethod.addHeader("Authorization", "basic " + Base64.encodeBytes(("admin"+":"+"admin123").getBytes()));
 //   httpClient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT));

     List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();  
     nameValuePairs.add(new BasicNameValuePair("vid", ""+1));
     nameValuePairs.add(new BasicNameValuePair("parent", ""+1));
     nameValuePairs.add(new BasicNameValuePair("maxdepth",""+1));
    // nameValuePairs.add(new BasicNameValuePair())
     postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs));  
     response = httpClient.execute(postMethod); 

     InputStream input = response.getEntity().getContent();
      BufferedReader rd = new BufferedReader(new InputStreamReader(input),input.toString().length());
     String line;
     StringBuilder sb =  new StringBuilder();
     while ((line = rd.readLine()) != null) {
     uploadresponse = sb.toString();

     Log.d("Response", ""+uploadresponse);
    }catch (Exception e) {
        // TODO: handle exception

Also if there is any firefox add on so that i can actually see the method working ??

Edit Again :-

I have found this add on restclient to work on firefox

i choose the method as post in the url i typed http://delvelogic.com/merchant/drupal-6.22/services/rest/taxonomy_vocabulary/getTree

added header :-

Content-type : application/x-www-form-urlencoded

Accept : application/json

request body :-


it gives me 404 not found with no vocabulary with id 1 found Thanks in advance

  • i pledge if i get this thing completely solved i will make a screencast for dumb people like me so that they dnt stuck up :P this module needs much resources
    – abhishek
    Commented Oct 10, 2011 at 10:42
  • check the edit now
    – abhishek
    Commented Oct 10, 2011 at 12:03

1 Answer 1


According to the documentation the URLs shouldn't necessarily have .json at the end, but I guess this is a setting you've changed if it's working for the node functions. I know you're not going to like this answer (I'm fairly certain you've tried it before) but the URL is: mydomain.com/service/rest/taxonomy_vocabulary/getTree. I've even been through the service and rest_server modules' respective code and that is definitely what it should be.

For further proof look at the (valid, passed) test module for services taxonomy_vocabulary:


You'll see that the URLs accessed by this successfully passed test are: $path . '/taxonomy_vocabulary/getTree', where $path is the path to the endpoint (i.e. mymodule.com/service/rest/).

It really would help if you could provide a live link though so we can test to see if the problem is in your Java code or with Drupal (although the latter seems very unlikely).


p.s. do comment on this answer as I have a lot of experience with the services module and I'm sure I can point you in the right direction with a bit more info. It pains me to see someone struggling with something that I've had nothing but joy with in the past!


This is the response I get from http://delvelogic.com/merchant/drupal-6.22/services/rest/taxonomy_vocabulary:

<?xml version="1.0" encoding="utf-8"?>

Notice the <vid>4</vid> bit...I'm pretty sure the vid you should be looking for is 4, not 1!

  • Thanks for the comment.. i have edited my question and added the live link and my android code.... the link you provided is giving me null delvelogic.com/merchant/drupal-6.22/services/rest/…
    – abhishek
    Commented Oct 10, 2011 at 10:31
  • you can check the edit now
    – abhishek
    Commented Oct 10, 2011 at 12:48
  • hey clive... is this a multipart data ??? should i send it in multipart??
    – abhishek
    Commented Oct 10, 2011 at 20:49
  • Sorry for delay, I don't think it does need to be multipart, no. I've got a bit of time now so I'll have a quick play with the modules in question and get back to you soon
    – Clive
    Commented Oct 10, 2011 at 21:03
  • not as in u owe me a solution but wud be nice to have it :)
    – abhishek
    Commented Oct 10, 2011 at 21:17

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.