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 :-
The exact uri or may be the procedure to call getTree method in taxonomy_vocabulary resource
How to acccess all the methods (CRUD) functions under every resource enabled
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("Accept","application/json");
// 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())
try{
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) {
sb.append(line);
}
rd.close();
uploadresponse = sb.toString();
Log.d("Response", ""+uploadresponse);
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
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 :-
&vid=1&parent=1&maxdepth=1
it gives me 404 not found with no vocabulary with id 1 found Thanks in advance