Skip to content

Instantly share code, notes, and snippets.

@kylebrowning
Created January 12, 2011 00:08
Show Gist options
  • Star 83 You must be signed in to star a gist
  • Fork 64 You must be signed in to fork a gist
  • Save kylebrowning/affc9864487bb1b9c918 to your computer and use it in GitHub Desktop.
Save kylebrowning/affc9864487bb1b9c918 to your computer and use it in GitHub Desktop.

#Node Resource ##Retrieve

  • Args:
  • HTTP Method : GET
  • Example URL : http://drupal6-services/services/plist/node/1
  • Expected Response(in JSON): {"nid":"1","type":"story","language":"","uid":"0","status":"0","created":"1286592762","changed":"1286592762","comment":"2","promote":"0","moderate":"0","sticky":"0","tined":"0","translate":"0","vid":"1","revision_uid":"1","title":"test","body":"test","teaser":"test","log":"","revision_timestamp":"1286592762","format":"1","name":"","picture":"","data":null,"last_comment_timestamp":"1286592762","last_comment_name":null,"comment_count":"0","taxonomy":[],"files":[],"uric":"http:\/\/drupal6-services\/services\/plist\/node\/1"}

##Create

  • Args: node*
  • HTTP Method: POST
  • Example URL : http://drupal6-services/services/plist/node
  • Example: &node[title]=testnode&node[type]=story&node[field_test][0][value]=testtting
  • Notes: field_test is a CCK field.
  • Expected Response(in JSON): {"nid":"45","uri":"http:\/\/drupal6-services\/services\/plist\/node\/45"}

##Update

##Delete

#Comment Resource ##Retrieve

  • Args:
  • HTTP Method : GET
  • Example URL : http://drupal6-services/services/plist/comment/30
  • Expected Response(in JSON): {"cid":"30","pid":"0","nid":"48","uid":"1","subject":"asdfadf","comment":"dfgsdfgsdg","hostname":"127.0.0.1","timestamp":"1294792128","status":"0","format":"1","thread":"01\/","name":"admin","mail":"","homepage":""}

##Create

  • Args: comment*
  • HTTP Method: POST
  • Example URL : http://drupal6-services/services/plist/comment
  • Example:&comment[body]=commentbody&comment[nid]=49
  • Expected Response(in JSON): {"cid":"31","uri":"http:\/\/drupal6-services\/services\/plist\/comment\/31"}

##Update

##Delete

#User Resource ##Retrieve

  • Args:
  • HTTP Method : GET
  • Example URL : http://drupal6-services/services/plist/user/1
  • Expected Response(in JSON): {"uid":"1","name":"admin","pass":"1a1dc91c907325c69271ddf0c944bc72","mail":"kyle@workhabit.com","mode":"0","sort":"0","threshold":"0","theme":"","signature":"","signature_format":"0","created":"1286571725","access":"1294792121","login":"1293782855","status":"1","timezone":null,"language":"","picture":"","init":"kyle@workhabit.com","data":"a:0:{}","roles":{"2":"authenticated user"}}

##Create

  • Args: account*
  • HTTP Method: POST
  • Example URL : http://drupal6-services/services/plist/user
  • Example: &account[name]=test&account[mail]=test@test.com&account[pass]=pass
  • Expected Response(in JSON): {"uid":"15","name":"test","pass":"1a1dc91c907325c69271ddf0c944bc72","mail":"test@test.com","mode":"0","sort":"0","threshold":"0","theme":"","signature":"","signature_format":"0","created":"1294793391","access":"1294793391","login":"0","status":"1","timezone":"-25200","language":"","picture":"","init":"test@test.com","data":"a:0:{}","roles":{"2":"authenticated user"},"password":"pass"}

##Update

##Delete

##Login

  • Args:
  • HTTP Method: POST
  • Example URL : http://drupal6-services/services/plist/user/login
  • Example: &name=admin&pass=pass
  • Expected Response(in JSON): {"sessid":"853c6c7f6eaa051724080dff202eeec0","session_name":"SESS8b1f176c338bbcc3922a56004cec3c41","user":{"uid":"1","name":"admin","pass":"1a1dc91c907325c69271ddf0c944bc72","mail":"kyle@workhabit.com","mode":"0","sort":"0","threshold":"0","theme":"","signature":"","signature_format":"0","created":"1286571725","access":"1294794381","login":1294794548,"status":"1","timezone":null,"language":"","picture":"","init":"kyle@workhabit.com","data":"a:0:{}","roles":{"2":"authenticated user"}}}

##Logout

@quocnam
Copy link

quocnam commented Jan 31, 2012

How to retrieve a view from services module drupal and display it?i see in service has a option can response a view

@dmouse
Copy link

dmouse commented Apr 5, 2012

any sample for oauth authentication?

@cheewe
Copy link

cheewe commented Jul 14, 2012

I am using user.login service via json server (using an iPad application) It appears that when the login is successful, the service returns the HTML content of the home page, while if it is not, it returns a json string that says why not. I was expecting it to return user information in the form of a json string when user.login is successful.

Is this an issue with my particular set up? Thanks!

@gurjinder1210
Copy link

i am using put service in android how to update user

@davidebukali
Copy link

hello how to upload video file using rest server file resource

@davidebukali
Copy link

hello how to upload video file using rest server file resource

@mdedere
Copy link

mdedere commented Feb 1, 2013

A good resource to unterstand the module Services is "Services Sandbox. Testing resources on a test server."
http://drupal.org/node/1447020. I wished I explored it first of all!

@anggiaj
Copy link

anggiaj commented Jun 2, 2013

Howdo create a contact (contact form module) with this service?

@talon
Copy link

talon commented Nov 19, 2014

@kylebrowning I forked this and formatted the JSON to be more perusable. I think it'd be useful if you updated your gist to reflect this change. https://gist.github.com/LegitTalon/b973a9748f93b8176742

@MuhammadReda
Copy link

@chaohaiding
Copy link

Does anyone know how to update the user's profile picture via restful services? Thx

@ravismula
Copy link

Can anyone let me know the exact structure for UPDATING a comment using PUT request
I've tried many formats but was unsuccessful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment