Settings

/settings

Retrieves or updates a users settings

NOTE: A user will only ever have 1 settings, if a POST occurs with an existing setting, it will treat it as a PUT request.

NOTE: If a GET request occurs and no settings exist, a default set of settings will be returned.

NOTE: alert_types will be replaced entirely on POST or PUT calls (so always send the entire map), because the developer was too lazy to write API calls to handle updating individual settings (for fear of there being many more settings later and it be unmanageable)

Possible Methods

GET POST PUT DELETE

Arguments

n/a

Json Object
{
    String user_id;
    Map<String, AlertTypeDbPojo> alert_types;
	int max_number_of_channels;
}

 

Example
curl -b cookies.txt -X GET "http://localhost:8185/settings" > response.txt
curl -b cookies.txt -X POST -d '{"alert_types":{"Regular":{"alert_methods":[{"method":"email","destination":"cburch@ikanow.com"}],"frequency_secs":86400},"Priority":{"alert_methods":[{"method":"email","destination":"cburch@ikanow.com"}],"frequency_secs":3601}}}' "http://localhost:8185/settings" > response.txt
curl -b cookies.txt -X PUT -d '{"alert_types":{"Regular":{"alert_methods":[{"method":"email","destination":"cburch@ikanow.com"}],"frequency_secs":86400},"Priority":{"alert_methods":[{"method":"email","destination":"cburch@ikanow.com"}],"frequency_secs":3602}}}' "http://localhost:8185/settings" > response.txt
curl -b cookies.txt -X DELETE "http://localhost:8185/settings" > response.txt

 

Example Response
curl -b cookies.txt -X POST -d '{"alert_types":{"Regular":{"alert_methods":[{"method":"email","destination":"cburch@ikanow.com"}],"frequency_secs":86400},"Priority":{"alert_methods":[{"method":"email","destination":"cburch@ikanow.com"}],"frequency_secs":3601}}}' "http://localhost:8185/settings" > response.txt

 

 {
    "response": {
        "action": "Settings",
        "success": true,
        "message": "Created user settings",
        "time": 0
    },
    "data": {
        "user_id": "5231d1dce4b07ac83db1077a",
        "alert_types": {
            "Regular": {
                "alert_methods": [{
                    "method": "email",
                    "destination": "cburch@ikanow.com"
                }],
                "frequency_secs": 86400
            },
            "Priority": {
                "alert_methods": [{
                    "method": "email",
                    "destination": "cburch@ikanow.com"
                }],
                "frequency_secs": 3601
            },
        "max_number_of_channels": 100
		 }
    }
}