The wouso API is a REST web service using OAuth v1.0 authentication, allowing your application to interact with a wouso instance.
A demo python library interfacing with the api is available here: http://github.com/rosedu/wouso-extras .
The updated list of wouso instances is available at: http://wouso.cs.pub.ro/instances.json . You need an user account on the instance in order to use its api.
Api information.
{
"api_version": "1",
"title": "World of USO",
"authenticated": false
}
Fetch information about players seen online in the last 10 minutes.
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
[
{
"first_name": "Alex",
"last_name": "Eftimie2",
"nickname": "admin",
"id": 1,
"last_seen": "2013-02-17T18:45:56.643"
}
]
Variation: /api/info/online/list/, with response: [ “admin”, ...]
Return the current player’s nickname.
Attempt to change the nickname of the authenticated player. The nickname is sent as the payload to the POST request. Possible errors: “no nickname”, “nickname already in use”.
POST /api/info/nickname/ HTTP/1.1
Host: wouso-next.rosedu.org
...
nickname=myl33tnickname
{ "success": True }
{ "success": False, "error": "Nickname in use" }
Register a new Android device for push notifications. POST data must contain registration_id.
List registered Android devices which will receive push notifications.
Return the notification count for the requesting user.
GET /api/notifications/all/ HTTP/1.1
Host: wouso-next.rosedu.org
Accept: application/json, text/javascript
Authorization: OAuth oauth_version="1.0",oauth_nonce="a1df9b758e16eaebe8a2208d1e210bfb",oauth_timestamp="1312861474",oauth_consumer_key="xxxxxx",oauth_token="xxxxx",oauth_signature_method="PLAINTEXT",oauth_signature="xxxxxx"
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
{
"count": 0
}
Status Codes: |
|
---|
Returns information about current (authenticated) user.
GET /api/player/1/info/ HTTP/1.1
Host: wouso-next.rosedu.org
Accept: application/json, text/javascript
Authorization: OAuth oauth_version="1.0",oauth_nonce="a1df9b758e16eaebe8a2208d1e210bfb",oauth_timestamp="1312861474",oauth_consumer_key="xxxxxx",oauth_token="xxxxx",oauth_signature_method="PLAINTEXT",oauth_signature="xxxxxx"
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
{
username: "alex.eftimie",
first_name: "Alex",
last_name: "Eftimie",
avatar: "http://www.gravatar.com/avatar/d43fad239b039cebdb4206cdc692f314.jpg",
level: {
name: "level-1",
title: "Level 1",
image: "",
percents: 100,
id: 2
},
level_no: 1,
level_progress: {
percent: 50,
next_level: 2,
points_gained: 55,
points_left: 45,
}
race: "Oxynia",
race_id: "1",
race_slug: "ca",
group: "CA311",
email: "alex@rosedu.org",
points: 0,
gold: 0,
}
Status Codes: |
|
---|
Returns information about current (authenticated) user. Same response as /api/player/(player_id)/info/.
Search for players matching query string.
GET /api/search/alex/ HTTP/1.1
Host: wouso-next.rosedu.org
Accept: application/json, text/javascript
Authorization: OAuth oauth_version="1.0",oauth_nonce="a1df9b758e16eaebe8a2208d1e210bfb",oauth_timestamp="1312861474",oauth_consumer_key="xxxxxx",oauth_token="xxxxx",oauth_signature_method="PLAINTEXT",oauth_signature="xxxxxx"
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
[
{
"id": 1,
"first_name": "Alex",
"last_name": "Eftimie",
}
]
Status Codes: |
|
---|
Returns a list of all available spells for buying.
GET /api/bazaar/ HTTP/1.1
Host: wouso-next.rosedu.org
Accept: application/json, text/javascript
Authorization: OAuth oauth_version="1.0",oauth_nonce="a1df9b758e16eaebe8a2208d1e210bfb",oauth_timestamp="1312861474",oauth_consumer_key="xxxxxx",oauth_token="xxxxx",oauth_signature_method="PLAINTEXT",oauth_signature="xxxxxx"
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
{
[
{
id: 30,
name: "challenge-cannot-be-challenged",
title: "Nu poate fi provocat",
type: "n",
due_days: 3,
image_url: "/static/upload/challenge.png",
price: 10,
percents: 100,
description: "Nu permite provocarea jucătorului pe care este aplicată."
},
]
}
Status Codes: |
|
---|
Returns a list of spells in current authenticated user’s inventory, also active and cast lists.
GET /api/bazaar/ HTTP/1.1
Host: wouso-next.rosedu.org
Accept: application/json, text/javascript
Authorization: OAuth oauth_version="1.0",oauth_nonce="a1df9b758e16eaebe8a2208d1e210bfb",oauth_timestamp="1312861474",oauth_consumer_key="xxxxxx",oauth_token="xxxxx",oauth_signature_method="PLAINTEXT",oauth_signature="xxxxxx"
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
{
spells_cast: [
{
due: "2013-04-04T15:50:03.643",
spell_id: 1,
spell_title: "Disguise -25%",
spell_name: "top-disguise",
image_url: "/static/image.png",
player_id: 1,
player: "admin"
}
],
spells_available: [
{
spell_id: 2,
spell_name: "top-disguise",
spell_title: "Disguise -15%",
image_url: "/static/image.png",
amount: 1
}
],
spells_onme: [
{
due: "2013-04-04T15:50:03.643",
spell_id: 1,
spell_title: "Disguise -25%",
spell_name: "top-disguise",
image_url: "/static/image.png",
source_id: 1,
source: "admin"
}
]
}
Status Codes: |
|
---|
Attempts to buy a spell sent as POST parameter. Returns success or error.
POST /api/bazaar/buy/ HTTP/1.1
Host: wouso-next.rosedu.org
Accept: application/json, text/javascript
Authorization: OAuth oauth_version="1.0",oauth_nonce="a1df9b758e16eaebe8a2208d1e210bfb",oauth_timestamp="1312861474",oauth_consumer_key="xxxxxx",oauth_token="xxxxx",oauth_signature_method="PLAINTEXT",oauth_signature="xxxxxx"
Content-Type: application/x-www-form-urlencoded
Content-Length: 7
spell=1
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
{
success: true
}
Status Codes: |
|
---|
Attempts to exchange an amount sent as POST parameter. Returns success or error.
The same as gold to points.
Cast a spell given as POST parameter to player_id. Accepts an optional days parameter.
POST /api/player/2/cast/ HTTP/1.1
Host: wouso-next.rosedu.org
Accept: application/json, text/javascript
Content-Type: application/x-www-form-urlencoded
Content-Length: 7
spell=1&days=2
{
success: true
}
Returns top races in the game, ordered by points.
[
{
title: "Others",
points: 2008,
id: 1,
name: "Others"
},
{
title: "Zota",
points: 315,
id: 4,
name: "CB"
}
...
]
Returns top groups in selected race, ordered by points.
Returns top players in selected race.
Returns top groups in the game, ordered by points.
Returns top players in selected group.
Returns top players in the game.
List all races defined in wouso.
All players in selected race.
All groups in selected race.
List all groups defined in wouso.
Returns information about the group: name, member count, rank.
All players in selected group.
Returns latest activity for group members.
Returns group points evolution.
Each message contains the subject, text, date, sender and receiver (both names and ids) and reply_to id.
The reply_to parameter refers to another message (not an user), for conversations. If it’s null, then the message is the first in a conversation.
[
{
"from": "Gică Popescu",
"from_id": 2,
"to": "admin",
"to_id": 1,
"id": 4,
"subject": "Re: Ce faci măi?",
"date": "2013-09-27T18:02:47.364",
"text": "bine facem",
"read": false,
"reply_to": 3
}
]
Get Question of The Day for current date.
GET /api/qotd/today/ HTTP/1.1
Host: wouso-next.rosedu.org
Accept: application/json, text/javascript
Authorization: OAuth oauth_version="1.0",oauth_nonce="a1df9b758e16eaebe8a2208d1e210bfb",oauth_timestamp="1312861474",oauth_consumer_key="xxxxxx",oauth_token="xxxxx",oauth_signature_method="PLAINTEXT",oauth_signature="xxxxxx"
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
{
text: "What is this?"
answers: {
10: "yes",
11: "no",
12: "other"
}
had_answered: false
}
Status Codes: |
|
---|
Attempt to response QotD, by sending the answer id as POST data. In case of error, success is set to false, and an error message is provided.
POST /api/qotd/today/ HTTP/1.1
Host: wouso-next.rosedu.org
Accept: application/json, text/javascript
Authorization: OAuth oauth_version="1.0",oauth_nonce="a1df9b758e16eaebe8a2208d1e210bfb",oauth_timestamp="1312861474",oauth_consumer_key="xxxxxx",oauth_token="xxxxx",oauth_signature_method="PLAINTEXT",oauth_signature="xxxxxx"
Content-Type: application/x-www-form-urlencoded
Content-Length: 9
answer=11
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
{
success: true
correct: true
}
HTTP/1.1 200 OK
Vary: Accept
Content-Type: text/javascript
{
success: false
error: "User already answered"
}
Status Codes: |
|
---|
Return a list of all active challenges.
Launch a new challenge against given player.
Accept specific challenge.
Refuse specific challenge.
Cancel specific challenge.
Return information and questions (content) for given challenge. Also set it as started for user requesting.
Example response:
{ success: true, status: "A", date: "2012-06-19 19:59:32" from: "test", to: "admin", seconds: 61, questions: { 21: { text: "S Which is the codename of current WoUSO devel version?", answers: { 81: "Piranha", 82: "4", 83: "no codename", 84: "nom nom nom" } }, 26: { text: "S In lumea UNIX un proces poate avea un singur proces parinte. In momentul in care parintele este omorat printr-ul semnal SIGKILL, procesul copil", answers: { 101: "este automat omorat si el", 102: "devine orfan, isi termina executia, fara a fi adoptat de nimeni", 103: "devine orfan si este automat adoptat de parintele parintelui (bunicul procesului)", 104: "devine orfan si este automat adoptat de procesul "init"" } } } }
Post answers to a challenge. These must be mapped as a list of POST parameters, using the question id as key, and answers ids comma separated.
POST /api/challenge/1/ HTTP/1.1
Host: wouso-next.rosedu.org
Accept: application/json, text/javascript
Authorization: OAuth oauth_version="1.0",oauth_nonce="a1df9b758e16eaebe8a2208d1e210bfb",oauth_timestamp="1312861474",oauth_consumer_key="xxxxxx",oauth_token="xxxxx",oauth_signature_method="PLAINTEXT",oauth_signature="xxxxxx"
Content-Type: application/x-www-form-urlencoded
Content-Length: 25
12=1&13=4&14=5,6&16=9&17=
This request sends the following answers:
{
12: [ 1 ],
13: [ 4 ],
14: [ 5, 6 ],
16: [ 9 ],
17: [ ]
}
The calls in the /admin/ namespace must be made by users having quest.change_quest permission set.
Return a list of quests.
[
{
id: 1,
title: "Gioconda",
start: "2012-11-08T14:11:42",
end: "2013-11-08T16:00:00"
}
]
Fetch user information regarding specific quest.
{
status: "Available",
current_level: 4,
user: {
id: 1
}
}
Increment current level for specific user and quest.
{
current_level: 5,
user: {
id: 3,
username: "toma"
}
}