Skip to content

Instantly share code, notes, and snippets.

@kylebrowning
Created January 12, 2011 00:08
Show Gist options
  • Select an option

  • Save kylebrowning/affc9864487bb1b9c918 to your computer and use it in GitHub Desktop.

Select an option

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

@jnross

jnross commented Sep 13, 2011

Copy link
Copy Markdown

Your curl requests look right to me, but I notice there is a seven minute window between login and logout. What were you doing during that seven minutes? If you logged in or logged out via the web browser during that time, it might have mucked up your session.

login: Date: Sun, 11 Sep 2011 18:37:30 GMT
logout: Date: Sun, 11 Sep 2011 18:44:13 GMT

@oliamb

oliamb commented Oct 23, 2011

Copy link
Copy Markdown

I got the same result than dhammikab on Drupal 7

@quocnam

quocnam commented Jan 3, 2012

Copy link
Copy Markdown

If node has a image field how to create node with image?

@joaopintocruz

Copy link
Copy Markdown

Hi,

When I retrieve a node (server/rest/node/8.xml) I get the taxonomy or field collection's ids, but not their value/structure... is there any way to get all of the info in one request?

Thank you

@quocnam

quocnam commented Jan 31, 2012

Copy link
Copy Markdown

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

@dmouse

dmouse commented Apr 5, 2012

Copy link
Copy Markdown

any sample for oauth authentication?

@cheewe

cheewe commented Jul 14, 2012

Copy link
Copy Markdown

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
Copy Markdown

i am using put service in android how to update user

@davidebukali

Copy link
Copy Markdown

hello how to upload video file using rest server file resource

@davidebukali

Copy link
Copy Markdown

hello how to upload video file using rest server file resource

@mdedere

mdedere commented Feb 1, 2013

Copy link
Copy Markdown

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

anggiaj commented Jun 2, 2013

Copy link
Copy Markdown

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

@talon

talon commented Nov 19, 2014

Copy link
Copy Markdown

@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
Copy Markdown

@chaohaiding

Copy link
Copy Markdown

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

@ravismula

Copy link
Copy Markdown

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