Skip to content

Commit 37aae43

Browse files
[GSoC] Updated Docs for leaderboard API and Added Docs for update avatar API (#25)
* Added Leaderboard API documentation * Added Username Exists API documentation * Added Nearby Edits by a User API documentation * Added Uploads by a user API documentation * Added Used Images by a user API documentation * Leaderboard DB documentation * Fixed Image load * Update README.md * Update DB Schema folder * Update README.md * Update DB Schema * Update leaderboard.md * Updated Docs
1 parent 86a7115 commit 37aae43

File tree

2 files changed

+57
-10
lines changed

2 files changed

+57
-10
lines changed

API/leaderboard.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Note: If username is not already added to leaderboard then it would be added in
2626

2727
## Optional Paramaters
2828

29-
- **avatar** - This should be only used if a new user needs to be added to the leaderboard and wants a custom avatar, should be just the file name from `https://commons.wikimedia.org/wiki/File:` For example: **User-avatar_Dark.png** If no **avatar** is supplied then default one would be used i.e. **Gnome-stock_person.svg**
29+
- **avatar** - This should be only used if a new user needs to be added to the leaderboard and wants a custom avatar, should be complete Image URL for example `https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png` If no **avatar** is supplied then default one would be used i.e. **https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png**
3030

3131
- **limit** - This is the limit for the number of results and should be passed along with offset, for example **5**
3232

@@ -46,56 +46,56 @@ curl --location --request GET 'https://tools.wmflabs.org/commons-android-app/too
4646
"username": "Syced",
4747
"category_count": 462,
4848
"limit": null,
49-
"avatar": "Gnome-stock_person.svg",
49+
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
5050
"offset": null,
5151
"duration": "all_time",
5252
"leaderboard_list": [
5353
{
5454
"username": "Fæ",
5555
"category_count": 107147,
56-
"avatar": "Gnome-stock_person.svg",
56+
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
5757
"rank": 1
5858
},
5959
{
6060
"username": "JAn Dudík",
6161
"category_count": 912,
62-
"avatar": "Gnome-stock_person.svg",
62+
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
6363
"rank": 2
6464
},
6565
{
6666
"username": "Vojtěch Dostál",
6767
"category_count": 749,
68-
"avatar": "Gnome-stock_person.svg",
68+
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
6969
"rank": 3
7070
},
7171
{
7272
"username": "Syced",
7373
"category_count": 462,
74-
"avatar": "Gnome-stock_person.svg",
74+
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
7575
"rank": 4
7676
},
7777
{
7878
"username": "Misaochan",
7979
"category_count": 101,
80-
"avatar": "Gnome-stock_person.svg",
80+
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
8181
"rank": 5
8282
},
8383
{
8484
"username": "Kookaburra 81",
8585
"category_count": 41,
86-
"avatar": "Gnome-stock_person.svg",
86+
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
8787
"rank": 6
8888
},
8989
{
9090
"username": "Madhurgupta10",
9191
"category_count": 1,
92-
"avatar": "Gnome-stock_person.svg",
92+
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
9393
"rank": 7
9494
},
9595
{
9696
"username": "Macgills2",
9797
"category_count": 1,
98-
"avatar": "Gnome-stock_person.svg",
98+
"avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png",
9999
"rank": 8
100100
}
101101
],

API/update_avatar.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Update Leaderboard Avatar API
2+
3+
This API is used to check if a username is valid or not.
4+
5+
## Base URL
6+
`https://tools.wmflabs.org/commons-android-app/tool-commons-android-app`
7+
8+
## Endpoint
9+
`/update_avatar.py`
10+
11+
## Request Type
12+
`GET`
13+
14+
## Response Type
15+
`JSON`
16+
17+
## Required Parameters
18+
19+
- **user** - This is username of the user, for example **Syced** (if username has **whitespaces** then replace them with `_` )
20+
21+
- **avatar** - This is url of the avatar to set, for example **https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png**
22+
23+
24+
## Example Request
25+
26+
```
27+
curl --location --request GET 'https://commons-android-app.toolforge.org/tool-commons-android-app/update_avatar.py?user=Syced&avatar=https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png'
28+
```
29+
30+
## Example Responses
31+
32+
```
33+
{
34+
"status": "200",
35+
"message": "Avatar Updated",
36+
"user": "Syced"
37+
}
38+
```
39+
40+
**Note: Returns error if params are invalid**
41+
```
42+
{
43+
"status": "400",
44+
"message": "Invalid Parameters",
45+
"user": null
46+
}
47+
```

0 commit comments

Comments
 (0)