Skip to content

Instantly share code, notes, and snippets.

@tiff
Last active August 29, 2015 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiff/7ecb525a1cc08f306a0e to your computer and use it in GitHub Desktop.
Save tiff/7ecb525a1cc08f306a0e to your computer and use it in GitHub Desktop.
Protonet REST API Examples

Protonet Rest API

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.

Authorization

The Protonet REST-API supports two authorization mechanisms:

  1. Basic authorization: Send email and password as base64 encoded string within the request headers

  2. 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 'foo@bar.de:secretpassword' --data '{"comment":"your app name"}'
    

GET /me

Retrieves information about the authorized user:

curl 'https://yourbox.protonet.info/api/v1/users/me' --user 'foo@bar.de:secretpassword'

GET /users

Retrieves a list of users which the authorized user is allowed to see:

curl 'https://yourbox.protonet.info/api/v1/users' --user 'foo@bar.de:secretpassword'

or by using token based authorization:

curl 'https://yourbox.protonet.info/api/v1/users?token=xxxxxxxxxxxxxxx'

GET /private_chats

Retrieves a list of private chats for the authorized user.

curl 'https://yourbox.protonet.info/api/v1/private_chats?limit=20' --user 'foo@bar.de:secretpassword'

GET /private_chats/:id

Retrieves all information about a single private chat by using its id:

curl 'https://yourbox.protonet.info/api/v1/private_chats/30' --user 'foo@bar.de:secretpassword'

GET /private_chats/:id/meeps

Retrieves recent messages for the given private chat:

curl 'https://yourbox.protonet.info/api/v1/private_chats/30/meeps' --user 'foo@bar.de:secretpassword'

POST /private_chats/:id/meeps

Send a message within a private chat:

curl 'https://yourbox.protonet.info/api/v1/private_chats/898/meeps' --user 'foo@bar.de: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 'foo@bar.de:secretpassword' -F files[]=@/local/path/to/file.jpg

PUT /private_chats/:id/subscriptions

Updates subscription values:

curl 'https://yourbox.protonet.info/api/v1/private_chats/654/subscriptions/14301' -X PUT --user 'foo@bar.de:secretpassword' -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"last_seen_meep_no":896}'

GET /projects

Retrieves all groups the authorized user is subscribed to:

curl 'https://yourbox.protonet.info/api/v1/projects' --user 'foo@bar.de:secretpassword'
@tiff
Copy link
Author

tiff commented Nov 7, 2014

Please note: The api is under active development. Many things are still missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment