X-Git-Url: http://git.maemo.org/git/?p=speedfreak;a=blobdiff_plain;f=documents%2FAPI.txt;h=36c13a498120fbe615a2822237aef2c560f9b449;hp=e29585dcc16986d050a8f30bb03814a2a9759470;hb=8785db5df89a4d417ffb965f919b53be8138fdd5;hpb=8e2751b9dddac3dfb08e3016bc4efcd73404ffe8 diff --git a/documents/API.txt b/documents/API.txt index e29585d..36c13a4 100644 --- a/documents/API.txt +++ b/documents/API.txt @@ -38,7 +38,7 @@ Here is the list of general errors that client might encounter: Registration process ==================== -URL: /register +URL: /users/register Every single client should register before it can send own measurement results or fetch other's results. During registration client has to supply following information: @@ -46,6 +46,7 @@ fetch other's results. During registration client has to supply following inform - Login: This is 3-12 charecters long nickname that has to be unique - Password: 6-255 charectors long password - Email: email address that will be used for password recovery etc. Has to be unique. +- Description: Additional information that user might want to supply. Below is example of XML that client might send to server to register an account: @@ -54,17 +55,20 @@ Below is example of XML that client might send to server to register an account: test827 thisisaveryinsecurepassword test@example.com + My car is cool If registration is successful server will return 200 HTTP status code along with text "OK" in the response body. In other cases (invalid email, login exists etc) server will return HTTP error code 400 with error message in the body text. +User can also supply avatar image as POST field named "avatar". Please notice that +avatar image must not exceed 100 kilobytes in size and should be supplied in Jpeg format. Login ===== -URL: /login +URL: /users/login Because communication with server has no state there is no need to login. Client might need to verify that credentials supplied by user are correct. In order to @@ -76,28 +80,59 @@ If credentials are correct server will return "OK" along with HTTP status code 2 In any other case it will return 401 HTTP error code along with error description. +List all users +============== + +URL: /users/list_all + +Using this you can get XML containing all registered users. Last activity attribute shows date and time +when user has contacted the server. Example output below: + + + + + + + + +Viewing user's profile +====================== + +URL: /users/info/username + +Username is in this case username of user who's information you want to retrieve. In return you will get XML +containing information about the user. Avatar attribute is only present for profiles that have uploaded their +avatar image to the server. Example output below: + + + + + Fetching results ================ -URL: /results/category_name/limit +URL: /results/list/category_name/limit/show_unit Category: For example "acceleration-0-100", "top-speed" and so on Limit: This will tell server how many results you want to get back. Results are ordered by record position starting with highest record first. -Both parameters are required. +category_name and limit are required parameters while show_unit is optional. show_unit can have +only one value which is true (string). When show_unit is specified every result will have a unit +attribute where by default it's km/h. Results can have up to two decimals. Dot is used as +decimal separator. Below is example of what client might get back in return when sending following -request: /results/acceleration-0-100/10 +request: /results/list_results/acceleration-0-100/10 - - + + - + @@ -108,7 +143,7 @@ request: /results/acceleration-0-100/10 Sending results =============== -URL: /update/category_name +URL: /results/update/category_name Category: same as when fetching results @@ -119,9 +154,24 @@ category that result belongs to. Below is example of XML: +Sending route +============= + +URL: + +Below is example of XML: + + + + + + + + + + Logout ====== There is no need to logout as server is stateless, but client can mimic logout -functionality by "forgetting" user credentials on the mobile device. - +functionality by "forgetting" user credentials on the mobile device. \ No newline at end of file