Drupal 7 + Services 3.2
I am using Postman for Chrome (a http client) to test the API.
What I want to do is login a user then create a node with the user by using the Drupal service API.
Below are what I tried:
Firstly, I logged in the user with JSON POST request to http://mysite.com/api/user/login :
Successfully, got return JSON:
{
"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 article create permission)
I got "401 Unauthorized" response.
So I guess I need to include the session cookie info to send the POST request for article create??
I have the session info previously returned:
"sessid": "KrZjlcY3rFr8v6iLoskcVQN9DmDWsg5yZqIjBeydEBY",
"session_name": "SESS9fe39db36ccd7afd64e034fefa0129e1",
How can I utilize it to make a successful JSON POST request for creating an article?
Thanks!