Skip to content
Jorge Heleno edited this page Apr 25, 2017 · 3 revisions

How to contact the server

The server is using http and is at this moment hosted at pikachu.rnl.tecnico.ulisboa.pt at port 31000. The endpoints are:


Contract for requests

  • /registerUser, required parameters: username, password
  • /loginUser, required parameters: username, password
  • /listLocations, required parameters: token
  • /addLocation, required parameters: token, name, at leastone of the next three 1: (latitude, longitude, radius), 2: bssids, 3: ssids
  • /removeLocation, required parameters: token, location(name of the location)
  • /postMessage, required parameters: token, location, message
  • /unpostMessage, required parameters: token, location, messageId
  • /readMessage, required parameters: token, location, messageId
  • /listMessages, required parameters: token, location
  • /addKey, required parameters: token, key, value
  • /listKeys, required parameters: token

Responses

All the responses come in the form of json. All the responses have at least the type of response and the response (success or fail)

  • /registerUser, nothing else
  • /loginUser, a token used to login
  • /listLocations, a list of locations
  • /addLocation, nothing else
  • /removeLocation, nothing else
  • /postMessage, nothing else
  • /unpostMessage, nothing else
  • /readMessage, the id of the message, content, author, location
  • /listMessages, a list of messages from the location
  • /addKey, nothing else
  • /listKeys, a list of key, value

1.1 Patch notes

Now all of the requests get a new field in the json for the reason! All the requests that fail without a reason should be reporte to Gisson with the request sent the the response given. All of the reason for failing are listed below:

  • /registerUser, user_exists
  • /loginUser, icorrect_username_password
  • /listLocations, a list of locations
  • /addLocation, location_exists, invalid_token
  • /removeLocation, no_such_location, invalid_token
  • /postMessage, invalid_token, no_such_location
  • /unpostMessage, no_such_location, invalid_token
  • /readMessage, no_such_location, no_such_message, incorrect_token
  • /listMessages, invalid_token, no_messages_found
  • /addKey, incorrect_token
  • /listKeys, incorrect_token
Clone this wiki locally