{"_id":"544a07c3778b3e08002b2279","version":{"_id":"543d1e5e5276641a00a593cf","forked_from":"543d1e263a300f20000d31fe","project":"543d1e263a300f20000d31fb","__v":16,"createdAt":"2014-10-14T13:00:14.946Z","releaseDate":"2014-10-14T13:00:14.946Z","categories":["543d1e5f5276641a00a593d0","543d1ee45276641a00a593da","5448e2cbc64edd1a00453c29","5449135acdc944220048845c","544a0a93778b3e08002b2289","544a0a9727b7fc140078da58","544a456f27b7fc140078daff","544e027cbd51b9080037f680","544e029ab80812080035bba6","544e3a2eb80812080035bd67","5450b7c5a66f020800dba7b3","5450c0e47abbbc0800a5e989","5450c0f97abbbc0800a5e98a","5450c103a66f020800dba819","54f99f588d09b7390007ea45","565c81dbf3e9360d00823e43"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"editedParams2":true,"parentDoc":null,"__v":1,"editedParams":true,"user":"54352decadf50e0800b89024","category":{"_id":"5449135acdc944220048845c","__v":4,"pages":["5449159bcdc944220048845f","544a04bd27b7fc140078da46","544a07c3778b3e08002b2279","544a089d778b3e08002b2281"],"project":"543d1e263a300f20000d31fb","version":"543d1e5e5276641a00a593cf","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-23T14:40:26.897Z","from_sync":false,"order":2,"slug":"session","title":"Session"},"project":"543d1e263a300f20000d31fb","is_link":false,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-10-24T08:03:15.246Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"try":true,"basic_auth":false,"method":"put","results":{"codes":[{"name":"","code":"{\n    \"token\": \"00i1n8h8nrc91czh\",\n    \"reference\": \"Ri1m74thtuc\",\n    \"expires\": \"2014-10-31T07:44:59+0000\",\n    \"user\": null,\n    \"permissions\": {\n        \"guest\": [\"api.public\", \"api.users.create\"]\n    },\n    \"provider\": null,\n    \"client_id\": \"00i1m74thtzd84czv848f4c1wezztolj\"\n}","language":"json","status":200},{"name":"","code":"{\n\t/* Session not found */\n}","language":"json","status":404}]},"settings":"","auth":"never","params":[{"_id":"544a07c3778b3e08002b227e","ref":"","in":"body","required":true,"desc":"Your API session token.","default":"","type":"string","name":"_token"},{"_id":"5620b772f761a4170068ebf6","ref":"","in":"body","required":false,"desc":"Your API session signature.","default":"","type":"string","name":"_signature"},{"_id":"544a07c3778b3e08002b227d","ref":"","in":"body","required":false,"desc":"If you need to set the client id on a session without one, you can do it with this argument.","default":"","type":"string","name":"client_id"},{"_id":"544a07c3778b3e08002b227c","ref":"","in":"body","required":false,"desc":"Login email address.","default":"","type":"string","name":"email"},{"_id":"544a07c3778b3e08002b227b","ref":"","in":"body","required":false,"desc":"Login password.","default":"","type":"string","name":"password"},{"_id":"544a07c3778b3e08002b227a","ref":"","in":"body","required":false,"desc":"Facebook login - access token for facebook.","default":"","type":"string","name":"facebook_token"}],"url":"/v2/sessions"},"isReference":false,"order":2,"body":"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"User Login\"\n}\n[/block]\nUser login is done, either by email and password, or with a facebook access token.\n\n**logout** is done by sending the email field set to an empty string.\n\nWhen a user is logged in, the `user` key of the session will be populated with the user object:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"token\\\": \\\"00i1n8u1a659h3x7\\\",\\n    \\\"reference\\\": \\\"Ri1h74thtuc\\\",\\n    \\\"expires\\\": \\\"2014-10-31T07:54:56+0000\\\",\\n    \\\"user\\\": {\\n        \\\"id\\\": 4794,\\n        \\\"ern\\\": \\\"ern:user:4794\\\",\\n        \\\"gender\\\": \\\"male\\\",\\n        \\\"birth_year\\\": 1989,\\n        \\\"name\\\": \\\"Henrik Tudborg\\\",\\n        \\\"email\\\": \\\"henrik:::at:::etilbudsavis.dk\\\",\\n        \\\"permissions\\\": {\\n            \\\"user\\\": [\\\"api.public\\\"],\\n            \\\"henrik@etilbudsavis.dk\\\": [\\n                \\\"api.users.4794.read\\\",\\n                \\\"api.users.4794.update\\\",\\n                \\\"api.users.4794.delete\\\"\\n            ]\\n        }\\n    },\\n    \\\"permissions\\\": {\\n        \\\"guest\\\": [\\\"api.public\\\", \\\"api.users.create\\\"],\\n        \\\"user\\\": [\\\"api.public\\\"],\\n        \\\"henrik@etilbudsavis.dk\\\": [\\n            \\\"api.users.4794.read\\\",\\n            \\\"api.users.4794.update\\\",\\n            \\\"api.users.4794.delete\\\"\\n        ]\\n    },\\n    \\\"provider\\\": \\\"etilbudsavis\\\",\\n    \\\"client_id\\\": \\\"00i1m74thtzd84czv848f4c1wezzzolj\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nHere, the `user` key and `provider` key is populated with user information.\n\nThe `provider` key is the login provider identifier.\nPossible options are:\n\n- \"etilbudsavis\" user is logged in with eTilbudsavis credentials\n- \"facebook\" user is logged in via facebook.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Session Permissions\"\n}\n[/block]\nWhen sending requests to the API, your session needs the correct permissions to perform\nthe request. The session permissions is found on the `permissions` key on the session object.\n\n**Note** that it is not the permissions found on the `user` object on the session object.\nThe permissions for a session is *only* the ones found on the `permissions` key on the session object.\n\nUsually you won't have to worry about what permissions that is available to you.\nIf you need to take UI action based on available permissions, see section on parsing permissions in the left sidebar.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Login with Facebook\"\n}\n[/block]\n\n_ comming soon _\n\n\n## Error codes\n\nIf the `facebook_token` provided is missing priviledged to read certain information from Facebook, you might get any of the following error codes:\n\n- 1431 : the `email` field is missing from Facebook user data.\n- 1432 : the `birthday` field is missing from Facebook user data.\n- 1433 : the `gender` field is missing from Facebook user data.\n- 1434 : the `locale` field is missing from Facebook user data.\n- 1435 : the `name` field is missing from Facebook user data.\n\nAll of the above fields can be manually provided to this endpoint.\nThe field names are the same as in the Facebook data (e.g. `email` field is named `email`).","excerpt":"","slug":"session-update","type":"endpoint","title":"Session Update"}

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

_token:
required
string
Your API session token.
_signature:
string
Your API session signature.
client_id:
string
If you need to set the client id on a session without one, you can do it with this argument.
email:
string
Login email address.
password:
string
Login password.
facebook_token:
string
Facebook login - access token for facebook.

Result Format


Documentation

Lorem ipsum dolor sit amet, consectetur adipiscing elit. [block:api-header] { "type": "basic", "title": "User Login" } [/block] User login is done, either by email and password, or with a facebook access token. **logout** is done by sending the email field set to an empty string. When a user is logged in, the `user` key of the session will be populated with the user object: [block:code] { "codes": [ { "code": "{\n \"token\": \"00i1n8u1a659h3x7\",\n \"reference\": \"Ri1h74thtuc\",\n \"expires\": \"2014-10-31T07:54:56+0000\",\n \"user\": {\n \"id\": 4794,\n \"ern\": \"ern:user:4794\",\n \"gender\": \"male\",\n \"birth_year\": 1989,\n \"name\": \"Henrik Tudborg\",\n \"email\": \"henrik@etilbudsavis.dk\",\n \"permissions\": {\n \"user\": [\"api.public\"],\n \"henrik@etilbudsavis.dk\": [\n \"api.users.4794.read\",\n \"api.users.4794.update\",\n \"api.users.4794.delete\"\n ]\n }\n },\n \"permissions\": {\n \"guest\": [\"api.public\", \"api.users.create\"],\n \"user\": [\"api.public\"],\n \"henrik@etilbudsavis.dk\": [\n \"api.users.4794.read\",\n \"api.users.4794.update\",\n \"api.users.4794.delete\"\n ]\n },\n \"provider\": \"etilbudsavis\",\n \"client_id\": \"00i1m74thtzd84czv848f4c1wezzzolj\"\n}", "language": "json" } ] } [/block] Here, the `user` key and `provider` key is populated with user information. The `provider` key is the login provider identifier. Possible options are: - "etilbudsavis" user is logged in with eTilbudsavis credentials - "facebook" user is logged in via facebook. [block:api-header] { "type": "basic", "title": "Session Permissions" } [/block] When sending requests to the API, your session needs the correct permissions to perform the request. The session permissions is found on the `permissions` key on the session object. **Note** that it is not the permissions found on the `user` object on the session object. The permissions for a session is *only* the ones found on the `permissions` key on the session object. Usually you won't have to worry about what permissions that is available to you. If you need to take UI action based on available permissions, see section on parsing permissions in the left sidebar. [block:api-header] { "type": "basic", "title": "Login with Facebook" } [/block] _ comming soon _ ## Error codes If the `facebook_token` provided is missing priviledged to read certain information from Facebook, you might get any of the following error codes: - 1431 : the `email` field is missing from Facebook user data. - 1432 : the `birthday` field is missing from Facebook user data. - 1433 : the `gender` field is missing from Facebook user data. - 1434 : the `locale` field is missing from Facebook user data. - 1435 : the `name` field is missing from Facebook user data. All of the above fields can be manually provided to this endpoint. The field names are the same as in the Facebook data (e.g. `email` field is named `email`).