Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Orion/Server API/Preference API"

m (add Server API category)
(doc update for bug 349929)
(2 intermediate revisions by 2 users not shown)
Line 32: Line 32:
 
  "Occupation":"Naturalist"
 
  "Occupation":"Naturalist"
 
  }
 
  }
| explain = Returns a JSON object with a member for each key, whose value is the current preference value for that key. Returns a 404 response if no such preference node is defined.
+
| explain = Returns a JSON object with a member for each key, whose value is the current preference value for that key. Returns an empty node (<tt>{}</tt>) if no such preference node is defined.
 
}}
 
}}
  
Line 74: Line 74:
 
| overview = Remove a single preference value
 
| overview = Remove a single preference value
 
| method = DELETE
 
| method = DELETE
| reqhead = /prefs/user/myprefs?key="Name"
+
| reqhead = /prefs/user/myprefs?key=Name
 
| resphead = 204 OK
 
| resphead = 204 OK
 
| explain = Deletion has no effect if no such preference exists.
 
| explain = Deletion has no effect if no such preference exists.
Line 91: Line 91:
 
[[Category:Orion/API|Preference]]
 
[[Category:Orion/API|Preference]]
 
[[Category:Orion:Preference API]]
 
[[Category:Orion:Preference API]]
[[Category:Orion/Server API]]
+
[[Category:Orion/Server API|Preference]]

Revision as of 19:16, 29 February 2016

Overview

Reading preferences

Obtaining a single preference value

Overview
Obtain the value of a single preference
HTTP Method
GET
Example Request
GET /prefs/user/myprefs?key=Name
Orion-Version: 1.0

  
Example Response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 17

{"Name":"Enkidu"}
Detailed Explanation
Returns a JSON object with a single member, whose name is the key and whose value is the current preference value. Returns a 404 response if no such preference is defined.


Obtaining a preference node

Overview
Obtain an entire preference node
HTTP Method
GET
Example Request
GET /prefs/user/myprefs
Orion-Version: 1.0

  
Example Response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 56

{
"Name":"Enkidu",
"Address":"Uruk",
"Occupation":"Naturalist"
}
Detailed Explanation
Returns a JSON object with a member for each key, whose value is the current preference value for that key. Returns an empty node ({}) if no such preference node is defined.


Modifying preferences

Change a single preference

Overview
Change the value of a single preference key
HTTP Method
PUT
Example Request
PUT /prefs/user/myprefs
Orion-Version: 1.0
Content-Length: 21
Content-Type: "application/x-www-form-urlencoded"

key=Name&value=Enkidu  
Example Response
HTTP/1.1 204


Detailed Explanation
If the request body is empty or does not define a key, a 400 ("Bad Request") response is returned. If the request body does not define a value, then the given preference key will be removed


Change an entire preference node

Overview
Sets an entire node of preference values.
HTTP Method
PUT
Example Request
PUT /prefs/user/myprefs
Orion-Version: 1.0
Content-Length: 44
Content-Type: application/json

{
"Name":"Enkidu",
"Address":"Uruk",
"Occupation":"Adventurer"
}  
Example Response
HTTP/1.1 204


Detailed Explanation
Any existing preference values not specified in the request body are removed.


Delete a single preference

Overview
Remove a single preference value
HTTP Method
DELETE
Example Request
DELETE /prefs/user/myprefs?key=Name

  
Example Response
HTTP/1.1 204 OK


Detailed Explanation
Deletion has no effect if no such preference exists.


Delete an entire preference node

Overview
Remove a preference node
HTTP Method
DELETE
Example Request
DELETE /prefs/user/myprefs

  
Example Response
HTTP/1.1 204 OK


Detailed Explanation
Deletion has no effect if no such preference exists.

Back to the top