API
The API provides access to the basic features and allows you to integrate Passwork in your infrastructure or develop your own client.
General- Data is sent by HTTP POST requests
- API End Point — http://ah-hah.com/api2/
- API uses JSON format
- We strongly recommend to use an HTTPS connection
{ 'response' : { ... }, 'errorCode' : '...', 'errorMessage' : '...' }
In case of an error, response is false.
All further examples relate to response field.
Open session
/api2/openSession
Creates a new session. Returns a session code, which has to be passed with each request. The session is automatically expired each few minutes.
Parameters:
email
User e-mail (login)
password
Authorization password
Success
{ 'code' : '...', // session code 'hash' : '...' // md5 hash of a master password }
Field сode has to be passed with each further request to the API.
Field hash helps to check if the master password is correct.
Errors:
response = false
Wrong login or password.
errorCode = banUser is banned due to repeated failed attempts to open a new session.
Get data
/api2/getData
Gets all passwords
Parameters:
session
Session code
Data
{ 'user' : '...', // user id 'groups' : [{ // array of vaults 'id' : '...', // vault id 'name' : '...', // vault name 'passwordCrypted' : '...', // encrypted vault invitation code 'folders' :[{ // array of folders 'id' : '...', // folder id 'name' : '...', // folder name 'passwords' : [{ // array of passwords 'id' : '...', // password id 'categoryId' : '...', // folder id 'groupId' : '...', // vault id 'name' : '...', // password name 'login' : '...', 'url', : '...', 'description' : '...', 'cryptedPassword' : '...', // encrypted password }] }] }], 'passwords' : [{ // array of passwords 'id' : '...', // password id 'categoryId' : '...', // folder id 'groupId' : '...', // vault id 'name' : '...', // password name 'login' : '...', 'url', : '...', 'description' : '...', 'cryptedPassword' : '...', // encrypted password }] }] }
Errors:
{ 'response' : false, 'errorCode' : 'expired', 'errorMessage' : 'Session expired' }
Session is expired. Needs opening a new session using openSession.
Update and insert
These API functions are in testing stage and will be published soon.Example
- Open a new session using openSession
- Load all data using getData
- Ask user for the master password
- Decrypt vault invitation code (using the master password) groups[X].passwordCrypted
- Decrypt data (using vault invitation code) groups[X].folders[Y].passwords[Z].cryptedPassword