All examples in this document are done via curl. You can however use any programming language to access the API. The API expects JSON and responds with JSON.
The Protonet REST-API supports two authorization mechanisms:
-
Basic authorization: Send email and password as base64 encoded string within the request headers
-
Token based authorization: By using basic authorization you can get a token with which you are able to authorize yourself for future API requests. This mechanism is recommended since it doesn't require the app to store the login credentials.
curl 'https://yourbox.protonet.info/api/v1/tokens' --user '[email protected]:secretpassword' --data '{"comment":"your app name"}'
Retrieves information about the authorized user:
curl 'https://yourbox.protonet.info/api/v1/users/me' --user '[email protected]:secretpassword'
Retrieves a list of users which the authorized user is allowed to see:
curl 'https://yourbox.protonet.info/api/v1/users' --user '[email protected]:secretpassword'
or by using token based authorization:
curl 'https://yourbox.protonet.info/api/v1/users?token=xxxxxxxxxxxxxxx'
Retrieves a list of private chats for the authorized user.
curl 'https://yourbox.protonet.info/api/v1/private_chats?limit=20' --user '[email protected]:secretpassword'
Retrieves all information about a single private chat by using its id:
curl 'https://yourbox.protonet.info/api/v1/private_chats/30' --user '[email protected]:secretpassword'
Retrieves recent messages for the given private chat:
curl 'https://yourbox.protonet.info/api/v1/private_chats/30/meeps' --user '[email protected]:secretpassword'
Send a message within a private chat:
curl 'https://yourbox.protonet.info/api/v1/private_chats/898/meeps' --user '[email protected]:secretpassword' --data-binary '{"message":"hello world"}' -H 'Content-Type: application/json;charset=UTF-8'
Attach a file:
curl 'https://yourbox.protonet.info/api/v1/private_chats/654/meeps' --user '[email protected]:secretpassword' -F files[]=@/local/path/to/file.jpg
Updates subscription values:
curl 'https://yourbox.protonet.info/api/v1/private_chats/654/subscriptions/14301' -X PUT --user '[email protected]:secretpassword' -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"last_seen_meep_no":896}'
Retrieves all groups the authorized user is subscribed to:
curl 'https://yourbox.protonet.info/api/v1/projects' --user '[email protected]:secretpassword'
Please note: The api is under active development. Many things are still missing.