diff --git a/API/leaderboard.md b/API/leaderboard.md index 3ffb251..b2a33e2 100644 --- a/API/leaderboard.md +++ b/API/leaderboard.md @@ -26,7 +26,7 @@ Note: If username is not already added to leaderboard then it would be added in ## Optional Paramaters -- **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** +- **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** - **limit** - This is the limit for the number of results and should be passed along with offset, for example **5** @@ -46,56 +46,56 @@ curl --location --request GET 'https://tools.wmflabs.org/commons-android-app/too "username": "Syced", "category_count": 462, "limit": null, - "avatar": "Gnome-stock_person.svg", + "avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png", "offset": null, "duration": "all_time", "leaderboard_list": [ { "username": "Fæ", "category_count": 107147, - "avatar": "Gnome-stock_person.svg", + "avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png", "rank": 1 }, { "username": "JAn Dudík", "category_count": 912, - "avatar": "Gnome-stock_person.svg", + "avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png", "rank": 2 }, { "username": "Vojtěch Dostál", "category_count": 749, - "avatar": "Gnome-stock_person.svg", + "avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png", "rank": 3 }, { "username": "Syced", "category_count": 462, - "avatar": "Gnome-stock_person.svg", + "avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png", "rank": 4 }, { "username": "Misaochan", "category_count": 101, - "avatar": "Gnome-stock_person.svg", + "avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png", "rank": 5 }, { "username": "Kookaburra 81", "category_count": 41, - "avatar": "Gnome-stock_person.svg", + "avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png", "rank": 6 }, { "username": "Madhurgupta10", "category_count": 1, - "avatar": "Gnome-stock_person.svg", + "avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png", "rank": 7 }, { "username": "Macgills2", "category_count": 1, - "avatar": "Gnome-stock_person.svg", + "avatar": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/200px-Gnome-stock_person.svg.png", "rank": 8 } ], diff --git a/API/update_avatar.md b/API/update_avatar.md new file mode 100644 index 0000000..43aeaeb --- /dev/null +++ b/API/update_avatar.md @@ -0,0 +1,47 @@ +# Update Leaderboard Avatar API + +This API is used to check if a username is valid or not. + +## Base URL +`https://tools.wmflabs.org/commons-android-app/tool-commons-android-app` + +## Endpoint +`/update_avatar.py` + +## Request Type +`GET` + +## Response Type +`JSON` + +## Required Parameters + +- **user** - This is username of the user, for example **Syced** (if username has **whitespaces** then replace them with `_` ) + +- **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** + + +## Example Request + +``` +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' +``` + +## Example Responses + +``` +{ + "status": "200", + "message": "Avatar Updated", + "user": "Syced" +} +``` + +**Note: Returns error if params are invalid** +``` +{ + "status": "400", + "message": "Invalid Parameters", + "user": null +} +``` \ No newline at end of file