Difference between revisions of "Sensaphone.net API/login"
(Created page with "=Sensaphone.net API= The Login API will be used to log in to the Sensaphone.net system. When a user logs in with their username and password they will be assigned a sessi...") |
(→Sensaphone.net API: Update Session data type.) |
||
| (5 intermediate revisions by 2 users not shown) | |||
| Line 4: | Line 4: | ||
==Example Call== | ==Example Call== | ||
| − | https://sensaphone.net/api/v1/login/{USERNAME}/{PASSWORD} | + | https://rest.sensaphone.net/api/v1/login/{USERNAME}/{PASSWORD} |
==Values== | ==Values== | ||
| Line 30: | Line 30: | ||
}}{{TableRowN| '''Request Property''' | '''Status''' | '''Type''' | '''Description''' | }}{{TableRowN| '''Request Property''' | '''Status''' | '''Type''' | '''Description''' | ||
}}{{TableRowN| acctid | Required | Integer | Static ID of user | }}{{TableRowN| acctid | Required | Integer | Static ID of user | ||
| − | }}{{TableRowN| session | Required | | + | }}{{TableRowN| session | Required | String | Session ID of user |
}}{{TableEnd}} | }}{{TableEnd}} | ||
<br> | <br> | ||
| Line 41: | Line 41: | ||
====Example JSON==== | ====Example JSON==== | ||
| + | Log in with a username and password using JSON mode. | ||
| + | *'''Request JSON:''' | ||
| + | { | ||
| + | "request_type":"create", | ||
| + | "resource": "login", | ||
| + | "user_name": "myusername", | ||
| + | "password": "pass123" | ||
| + | } | ||
| + | |||
| + | *'''Response JSON:''' | ||
| + | { | ||
| + | "result": { | ||
| + | "success": true, | ||
| + | "code": 0, | ||
| + | "message": "Success" | ||
| + | }, | ||
| + | "response": { | ||
| + | "acctid": 987654, | ||
| + | "session": "0123-4567-8901", | ||
| + | "login_timestamp": 1499459402, | ||
| + | "session_expiration": 86400, | ||
| + | "user_id": 00000001 | ||
| + | } | ||
| + | } | ||
| + | |||
Receive Login information for a given session UUID. | Receive Login information for a given session UUID. | ||
| Line 79: | Line 104: | ||
}}{{TableRowN| '''Request Property''' | '''Status''' | '''Type''' | '''Description''' | }}{{TableRowN| '''Request Property''' | '''Status''' | '''Type''' | '''Description''' | ||
}}{{TableRowN| acctid | Required | Integer | Static ID of user | }}{{TableRowN| acctid | Required | Integer | Static ID of user | ||
| − | }}{{TableRowN| session | + | }}{{TableRowN| session | Required | String | Session ID of user |
}}{{TableRowN| user_name | Optional | String | Username | }}{{TableRowN| user_name | Optional | String | Username | ||
}}{{TableRowN| password | Optional | String | Password for username | }}{{TableRowN| password | Optional | String | Password for username | ||
| Line 85: | Line 110: | ||
<br> | <br> | ||
{{TableStart|border_size=1 | {{TableStart|border_size=1 | ||
| − | }}{{TableRowN| '''Response Property''' | '''Included''' | '''Type''' | '''Description''' | + | }}{{TableRowN| '''Response Property''' | '''Included''' | '''Type''' | '''Description''' |
}}{{TableRowN| acctid | Conditionally* | Integer | Static ID of user | }}{{TableRowN| acctid | Conditionally* | Integer | Static ID of user | ||
| − | }}{{TableRowN| session | + | }}{{TableRowN| session | Conditionally* | String | Session ID of user |
| − | }}{{TableRowN| login_timestamp | Always | + | }}{{TableRowN| login_timestamp | Always | Integer | Time stamp of renewed session |
| − | }}{{TableRowN| session_expiration | Always | + | }}{{TableRowN| session_expiration | Always | Integer | Time until new log in session expiration |
| − | }}{{TableRowN| user_id | + | }}{{TableRowN| user_id | Always | Integer | ID of the logged in user |
}}{{TableEnd}} | }}{{TableEnd}} | ||
<nowiki>*</nowiki> There may be an instance where the system needs to create a new Session ID and/or Account ID. In which case, it will be outputted in the PUT response. | <nowiki>*</nowiki> There may be an instance where the system needs to create a new Session ID and/or Account ID. In which case, it will be outputted in the PUT response. | ||
| Line 110: | Line 135: | ||
}}{{TableRowN| '''Response Property''' | '''Type''' | '''Description''' | }}{{TableRowN| '''Response Property''' | '''Type''' | '''Description''' | ||
}}{{TableRowN| acctid | Integer | Static ID of user | }}{{TableRowN| acctid | Integer | Static ID of user | ||
| − | }}{{TableRowN| session | + | }}{{TableRowN| session | String | Session ID of user |
}}{{TableRowN| login_timestamp | Integer | Time stamp of renewed session | }}{{TableRowN| login_timestamp | Integer | Time stamp of renewed session | ||
}}{{TableRowN| session_expiration | Integer | Time until new log in expiration | }}{{TableRowN| session_expiration | Integer | Time until new log in expiration | ||
| − | }}{{TableRowN| user_id | + | }}{{TableRowN| user_id | Integer | ID of the logged in user |
}}{{TableEnd}} | }}{{TableEnd}} | ||
| Line 121: | Line 146: | ||
'''URI Mode Request URI:''' | '''URI Mode Request URI:''' | ||
*Request to log out of a session | *Request to log out of a session | ||
| − | '''DELETE''' https://rest.sensaphone.net/api/v1 | + | '''DELETE''' https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSION}/login |
'''JSON Mode Request URI:''' | '''JSON Mode Request URI:''' | ||
'''POST''' https://rest.sensaphone.net/api/v1/login | '''POST''' https://rest.sensaphone.net/api/v1/login | ||
| Line 128: | Line 153: | ||
}}{{TableRowN| '''Request Property''' | '''Status''' | '''Type''' | '''Description''' | }}{{TableRowN| '''Request Property''' | '''Status''' | '''Type''' | '''Description''' | ||
}}{{TableRowN| acctid | Required | Integer | Static ID of user | }}{{TableRowN| acctid | Required | Integer | Static ID of user | ||
| − | }}{{TableRowN| session | + | }}{{TableRowN| session | Required | String | Session ID of user |
}}{{TableEnd}} | }}{{TableEnd}} | ||
==Future== | ==Future== | ||
In the future the login process will support OAuth for advanced access and authentication. | In the future the login process will support OAuth for advanced access and authentication. | ||
| + | |||
| + | ==Password Reset== | ||
| + | To reset a pass for a particular email, use the following request: | ||
| + | |||
| + | '''POST''' https://rest.sensaphone.net/api/v1/login/reset_password/{email_address} | ||
Latest revision as of 11:28, 10 July 2025
Contents
Sensaphone.net API
The Login API will be used to log in to the Sensaphone.net system. When a user logs in with their username and password they will be assigned a session UUID. The session UUID will have a corresponding time stamp and a timed expiration for their session. The session UUID and statically assigned Account ID will be used as the primary identifier instead of including a username and password in subsequent URI requests.
Example Call
https://rest.sensaphone.net/api/v1/login/{USERNAME}/{PASSWORD}
Values
- Username
- Password
- Session UUID
- Session Time stamp
- Session Expiration
Example Requests
GET
URI Mode Request URI's:
- Receive Login information
GET https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSION}/login
- Receive a Login timestamp for a session
GET https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSION}/login/login_timestamp
- Receive the number of seconds until a session expires
GET https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSION}/login/session_expiration
JSON MODE Request URI:
- Receive Login information
POST https://rest.sensaphone.net/api/v1/login
| Request Property | Status | Type | Description |
| acctid | Required | Integer | Static ID of user |
| session | Required | String | Session ID of user |
| Response Property | Included | Type | Description |
| login_timestamp | Optional | String | Time stamp of last log in |
| session_expiration | Optional | Integer | Seconds until log in expiration |
| user_id | Optional | Integer | ID of the logged in user |
Example JSON
Log in with a username and password using JSON mode.
- Request JSON:
{
"request_type":"create",
"resource": "login",
"user_name": "myusername",
"password": "pass123"
}
- Response JSON:
{
"result": {
"success": true,
"code": 0,
"message": "Success"
},
"response": {
"acctid": 987654,
"session": "0123-4567-8901",
"login_timestamp": 1499459402,
"session_expiration": 86400,
"user_id": 00000001
}
}
Receive Login information for a given session UUID.
- Request JSON:
{
"request_type:"read",
"resource":"login",
"acctid":987654,
"session":"0123-4567-8901",
"login":null
}
- Response JSON:
{
"result":
{
"success: true,
"code": 0,
"message":"OK",
},
"response":
{
"login_timestamp":"2014-12-31 23:59:59",
"session_expiration":60
}
}
PUT
PUT will be used only to update a Login session.
URI Mode Request URI:
- Request to update a Login session
PUT https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSION}/login
JSON Mode Request URI:
POST https://rest.sensaphone.net/api/v1/login
| Request Property | Status | Type | Description |
| acctid | Required | Integer | Static ID of user |
| session | Required | String | Session ID of user |
| user_name | Optional | String | Username |
| password | Optional | String | Password for username |
| Response Property | Included | Type | Description |
| acctid | Conditionally* | Integer | Static ID of user |
| session | Conditionally* | String | Session ID of user |
| login_timestamp | Always | Integer | Time stamp of renewed session |
| session_expiration | Always | Integer | Time until new log in session expiration |
| user_id | Always | Integer | ID of the logged in user |
* There may be an instance where the system needs to create a new Session ID and/or Account ID. In which case, it will be outputted in the PUT response.
POST
URI Mode Request URI:
- Request for creating a new login session
POST https://rest.sensaphone.net/api/v1/login/{USERNAME}/{PASSWORD}
JSON Mode Request URI:
POST https://rest.sensaphone.net/api/v1/login
| Request Property | Status | Type | Description |
| user_name | Required | String | Username |
| password | Required | String | Password for username |
| Response Property | Type | Description |
| acctid | Integer | Static ID of user |
| session | String | Session ID of user |
| login_timestamp | Integer | Time stamp of renewed session |
| session_expiration | Integer | Time until new log in expiration |
| user_id | Integer | ID of the logged in user |
DELETE
Deleting a login session is the equivalent to logging out.
URI Mode Request URI:
- Request to log out of a session
DELETE https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSION}/login
JSON Mode Request URI:
POST https://rest.sensaphone.net/api/v1/login
| Request Property | Status | Type | Description |
| acctid | Required | Integer | Static ID of user |
| session | Required | String | Session ID of user |
Future
In the future the login process will support OAuth for advanced access and authentication.
Password Reset
To reset a pass for a particular email, use the following request:
POST https://rest.sensaphone.net/api/v1/login/reset_password/{email_address}