How do I POST a new node? I have referred many links including the following:


Services module. How to construct the JSON data with session info for creating node? 
GitHub
- Creating a node using Services 6.3 REST


I tried several ways to POST a new node to a Drupal site, but I have failed. I have created a sample CCK for storing students data with name, age, gender, DOB, and added some list.

I have installed and configured the Services module (D7), and created a service end point at services.
As expected, GET is the easiest way to get details of a node in JSON. http://localhost/drupal/services/node simply listed all nodes.

I still can't figure out how to use the POST method.


I would like to search for the students whose name contains john. I tried localhost/drupal/services/node&amp;node[name]=john. I used  POST Man plugin for Chrome without success. I also tried some other ways.
I tried adding a new student to the site without success.


Can anyone guide me to make the above work fine?

UPDATE :

I tried adding new nodes of type article . It worked fine. but when i am trying to add nodes of type Department CCK It is showing "s:22:"CSRF validation failed";" 
Here are the screen shots

I have gone through the link https://drupal.org/node/2013781

I followed session = session_name=session_id but i still get an error.
Hope this will help you,

For Drupal 7

Tools used:


Firefox Poster add-on to do tests and debugging. 
There may be other add-on as well. But for this example im using Firefox add-on.
To help editing and validating the JSON data you can use


Edit the JSON data using this link
Validate the JSON data using this link



HTTP requests


To make the HTTP requests, you need use the Firefox add-on POSTER.
Two commonly used methods for a request-response between a client and server are: 


GET 
POST

After the add-on is Downloaded. Open Firefox -> Tools -> Poster 


Make sure to enable the Session authentication. After the Services is configured properly, before creating the node you should log-in. Once logged-in you can create the nodes.
For login use POST method, with the URL like - http://XXXXXXXX.com/demo/rulebook/rulebook_endpoint/user/login 


If it is a valid user then it will return user details with session ID and Name. If not valid it will return Access denied


By using Session name and ID in the POST HEADER, we can able to create new nodes


Now after adding the HEADER, You need to make HTTP POST request and make sure  user should have permissions to create node.


If the node is created you will get the response with node link




NOTE : If you want the response in JSON then, you should always append .json at the end of the URL. eg., http://XXXXXXXX.com/test/endpoint/user.json OR http://XXXXXXXX.com/test/endpoint/node.json OR http://XXXXXXXX.com/test/endpoint/user/user_id.json OR http://XXXXXXXX.com/test/endpoint/node/node_id.json