I am trying to create nodes with authentication with the services module enabled. So far I have done following things:
Get services token from
http://localhost/drupal/services/session/token
.User authentication: I did trigger login web service and in return I got session name, id and complete user information. I called this web service by passing
X-CSRF-Token
which I got from previous web service. (http://localhost/drupal/myendpoint/user/login.json`)Node creation: I want to create article content type node. I am passing fields values in JSON and CSRF token and session information as following. (
http://localhost/drupal/myrest/node.create
)Body (application/x-www-form-urlencoded)
{ "title":"Created through service", "type":"article", "body": { "value": "<p>test</p>\n", "format": "filtered_html" } }
Headers
X-CSRF-Token: bla bla bla
`SESSion name: bla bla bla
The response I received from node create web service is the following:
Status Code: 406
Date: Fri, 04 Dec 2015 23:43:31 GMT
X-Content-Type-Options: nosniff
Server: Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.12
X-Powered-By: PHP/5.5.12
Content-Type: text/html
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Content-Length: 0
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Could you please let me know what I am doing incorrect while triggering node create web service?