Skip to content
Audrey Loeffel edited this page May 29, 2016 · 6 revisions

#API

##request http://localhost:7777/stats?userId=1342jdijk23&frequency=day:a&frequency=week:b&frequency=month:c&frequency=year:d&allTime=true

##Parameters

name description
userId the id of the user
frequency entity to return
allTime if the summary of allTime should be included (true, false), if omitted defaults to false

###frequency May contain any of the following values:

  • day
  • week
  • month
  • year

The above example we would expect to have the query to return:

  • 'a' number of days from the current date
  • 'b' weeks from the current date
  • 'c' months from the current date
  • 'd' years from the current date

##Example

http://localhost:7777/stats?userId=1342jdijk23&frequency=day:10

this would return the summary of the last 10 days (including the current day)

##Default values if no parameter is specified (only the userId) the following default values should be used:

http://localhost:7777/stats?userId=1342jdijk23

would return:

  • last 30 days
  • last 5 weeks
  • last 12 months
  • all years

And example response would look like the following: ##Main response object

{
    "userId": "1342jdijk23",
    "frequencyOfPlays": {
        "days": [
            {
                "ago": 0,
                "amount": 5,
                "won": 3,
                "lost": 0,
                "questionsBreakDown": [
                    {
                        "type": "MC",
                        "totalAmount": 34,
                        "correct": 20,
                        "percentCorrect": 0.5882352941
                    },
                    {
                        "type": "TL",
                        "totalAmount": 34,
                        "correct": 20,
                        "percentCorrect": 0.5882352941
                    },
                    {
                        "type": "Geo",
                        "totalAmount": 34,
                        "correct": 20,
                        "percentCorrect": 0.5882352941
                    },
                    {
                        "type": "ORD",
                        "totalAmount": 34,
                        "correct": 20,
                        "percentCorrect": 0.5882352941
                    }
                ],
                "gamesPlayedAgainst": [
                    {
                        "userId": "1353342jkdilw",
                        "numberOfGames": "3",
                        "won": 1,
                        "lost": 2
                    },
                    {
                        "userId": "135887742jktil",
                        "numberOfGames": "3",
                        "won": 2,
                        "lost": 0
                    }
                ]
            },
            {
                "ago": 1,
                "amount": 3,
                "won": 1,
                "lost": 2,
                "questionsBreakDown": "...",
                "mostPlayedAgainst": "..."
            }
        ],
        "week": [
            //... up to 5 weeks ago, same structure as days
        ],
        "month": [
            //... up to 12 months ago, same strucure as days
        ],
        "year": [
            //...up to the beginning of the players life on our platform, same strucure as days
        ],
        "allTime": [
            //Summary from the beginning of time, same structure as days
        ]
    }
}

Clone this wiki locally