Preferences Server

From wiki.gpii
Jump to: navigation, search
See Also

Preferences Server API


The Preferences Server is a Kettle app that stores user preferences and responds to HTTP requests to retrieve or save preferences.

Note: As mentioned in an e-mail from March 2014, older versions of a preference set are stored by the underlying database system (CouchDB) but there is no API to access these older versions. Hence, a preferences editor for settings expressed in common terms will overwrite an existing preferences set when it saves settings to the server. If it is necessary to preserve any application-specific settings in a preference set, the preferences editor should take measures to combine the (already existing) application-specific settings and the (new) settings that use common terms in a single request to the Preferences Server. See also User Post Request Handler.


The Preferences Server coordinates responses several requests, as described below. For more information on the request handling, see the page for the particular request handler.

User Get

Description Retrieve the preferences for a particular user
Request type GET
Request format <url to prefs server>/user/<user token>
Handled by User Get Request Handler

User Post

Description Save or create the preferences for a particular user
Request type POST
Request format <url to prefs server>/user/<user token>?
Handled by User Post Request Handler

Running a Preferences Server Locally

By default, a cloud-based Flow Manager will use the online Preferences Server at In some cases (e.g. if you are developing with a local cloud-based Flow Manager and want to use your own N&P sets), you have to run your own instance of a Preferences Server.

To run the Preferences Server locally:

  • tell your Flow Manager to use your own instance of the preferences server by editing gpii/node_modules/flowManager/configs/cloudBased.json and replacing "preferences": "" with "preferences": "http://localhost:8082/user/%token";
  • tell your own instance of the preferences server to run on port 8082, by editing gpii/node_modules/preferencesServer/configs/development.json and add "port": 8082 under kettle.server's options block; then
  • run the Flow Manager and the MatchMaker as it is described above; and
  • in another console, run:
 node node_modules/kettle/lib/init.js gpii/node_modules/preferencesServer/configs/