I am using Drupal 7 and the Services module 7.x-3.2. I am using Postman for Chrome (a http client) to test the API.
What I want to do is log in a user and create a node with the user using the Drupal service API.
I logged in the user with JSON POST request to http://example.com/api/user/login.
I successfully got the JSON result.
{
"sessid": "KrZjlcY3rFr8v6iLoskcVQN9DmDWsg5yZqIjBeydEBY",
"session_name": "SESS9fe39db36ccd7afd64e034fefa0129e1",
"user": {
"uid": "31",
"name": "test_user",
"mail": "[email protected]",
"theme": "",
"signature": "",
"signature_format": "filtered_html",
"created": "1352985941",
"access": "1352991170",
"login": 1352991510,
"status": "1",
"timezone": "",
"language": "",
"picture": null,
"init": "[email protected]",
"data": false,
"roles": {
"2": "authenticated user"
},
"rdf_mapping": {
"rdftype": [
"sioc:UserAccount"
],
"name": {
"predicates": [
"foaf:name"
]
},
"homepage": {
"predicates": [
"foaf:page"
],
"type": "rel"
}
}
}
}
Then I tried to create an article via the API by sending the JSON POST request. (The user has the permission to create Article nodes.)
I got a 401 Unauthorized response.
I guess I need to include the session cookie information to send the POST request, to create a node.
I have the session information previously returned.
"sessid": "KrZjlcY3rFr8v6iLoskcVQN9DmDWsg5yZqIjBeydEBY",
"session_name": "SESS9fe39db36ccd7afd64e034fefa0129e1",
How can I utilize it to make a successful JSON POST request for creating a node?