Giter Club home page Giter Club logo

datagamer-api-v2's Introduction

Datagamer v2

Datagamer, to gamers from gamers. Participative video games database, for your web site.

Web site : datagamer.fr - This is the URL for the V1 API in PHP !

Many video games web site maintain their own database. The problem is that no web site gives a free access to their database ! Developers who want to set up video games web site need automatically to build a database.

This new version of the API is full REST, written in Node.js and run with a MongoDb database.

Unlike the v1, this v2 automatically populate itself when users search video games !

THIS V2 IS AVAILABLE ONLINE at http://movie-discover.com:8084/api

*The current release works ONLY with PC platform games /!*

Table of Contents

Authentication

First of all, you need to create a new user. User have an API key needed for every requests !

Request a new user with a POST request :

URL : http:movie-discover.com:8084/api/users
POST data : {name: "username", email: "[email protected]"}
Return : {code, message, user: {name, email, apiKey}}

Once you have your API key, you just need to pass it through the Headers each time to be authenticated.

Example : Return game info with GET request

Headers : {apiKey : b3dae6c0-83a0-4721-9901-bf0ee7011af}
URL : http://movie-discover.com:8084/api/games/by/id/12

User

Get a list of users

Method : GET

URL : /api/users/?skip={skip}&limit={limit}
Return : {code, message, count, skip, limit, users:[{user}]}

Get a user by name

Method : GET

URL : /api/users/by/name/{name}
Return : {code, message, count, users:[{user}]}

Get a user by id

Method : GET

URL : /api/users/by/id/{id}
Return : {code, message, user}

Add a new user

Method : POST - Only request with no authentication !

URL : /api/users
Form param : {name, email}
Return : {code, message, user}

Update a user

Method : PUT

URL : /api/users/{id}
Return : {code, message, user}

Delete a user

Method : DELETE

URL : /api/users/{id}
Return : {code, message}

Developer, Editor, Genre & Platform

I show only the methods associated with the developer but other objects support the exact same syntax.

Get a list of developers

Method : GET

URL : /api/developers/?skip={skip}&limit={limit}
Return : {code, message, count, skip, limit, developers:[{developer}]}

Get a developer by name

Method : GET

URL : /api/developers/by/name/{name}
Return : {code, message, count, developers:[{developer}]}

Get a developer by id

Method : GET

URL : /api/developers/by/id/{id}
Return : {code, message, developer}

Add a new developer

Method : POST - Only Genre object don't have an image attribute.

URL : /api/developers
Form param : {name, image}
Return : {code, message, developer}

Update a developer

Method : PUT - Only Genre object don't have an image attribute.

URL : /api/developers/{id}
Form param : {name, image}
Return : {code, message, developer}

Delete a developer

Method : DELETE

URL : /api/developers/{id}
Return : {code, message}

##Game

Get a list of games

Method : GET

URL : /api/games/?skip={skip}&limit={limit}
Return : {code, message, count, skip, limit, games:[{game}]}

Get count of all games

Method : GET

URL : /api/games/count
Return : {code, message, count}

Get top 10 of games by metacritic score

Method : GET

URL : /api/games/top/{limit}
Return : {code, message, games}

Get a list of games which can be similar by their default title

Method : GET

URL : /api/games/similar/by/{percentage}/for/{defaultTile}
Return : {code, message, games:[{game}]}

Get games by default title

Method : GET

URL : /api/games/by/defaultTitle/{defaultTitle}
Return : {code, message, count, games:[{game}]}

Get a game by id

Method : GET - Return a game with extended information. This method will automatically update the game information if needed.

URL : /api/games/by/id/{id}
Return : {code, message, game}

Add a new game

Method : POST - Only defaultTitle is mandatory !

URL : /api/games
Form params : {defaultTitle, overiew, titles: [{name, countryCode}], releaseDates: [{date, countryCode}], versions: [{number, date, description}], metacritic: {score, url}, editors: [{Editor._id}], developers: [{Developer._id}], genres: [{Genre._id}], platforms: [{Platform._id}], media: {boxArt: {front, rear}, thumbnails[], logos[], banners[], fanArts[], screenshots[], trailers}}
Return : {code, message, game}

**Country code** must be ISO alpha 3 code in uppercase.

Update a game

Method : PUT

URL : /api/games/{id}
Form params : {defaultTitle, overiew, titles: [{name, countryCode}], releaseDates: [{date, countryCode}], versions: [{number, date, description}], metacritic: {score, url}, editors: [{Editor._id}], developers: [{Developer._id}], genres: [{Genre._id}], platforms: [{Platform._id}], media: {boxArt: {front, rear}, thumbnails[], logos[], banners[], fanArts[], screenshots[], trailers}}
Return : {code, message, game}

Delete a game

Method : DELETE

URL : /api/games/{id}
Return : {code, message}

Status codes

code: 200, message: Success !
code: 201, message: Success, new resource added !
code: 202, message: Success, existing resource updated !
code: 204, message: Success, no content to return !

code: 304, message: No error but nothing happened here !

code: 400, message: Bad request syntax !
code: 403, message: Invalid API key !
code: 404, message: Resource doesn't exist in database !
code: 410, message: Precondition failed, check header content !
code: 411, message: Mandatory data missing !
code: 412, message: Resource already exist in database !

code: 500, message: Server error !

Objects

User

{name, email, apiKey}
  • name : String required
  • email : String email format
  • apiKey : String auto generated once

Developer, Editor & Platform

{name, image, creationDate, updateDate}
  • name : String required
  • image : String represent a substainable URL
  • creationDate : Date auto generated once
  • updateDate : Date auto generated at each update

Genre

{name, creationDate, updateDate}
  • name : String required
  • creationDate : Date auto generated once
  • updateDate : Date auto generated at each update

Game

{defaultTitle, overiew, titles: [{name, countryCode}], releaseDates: [{date, countryCode}], versions: [{number, date, description}], metacritic: {score, url}, editors: [{Editor._id}], developers: [{Developer._id}], genres: [{Genre._id}], platforms: [{Platform._id}], media: {boxArt: {front, rear}, thumbnails[], logos[], banners[], fanArts[], screenshots[], trailers}}
  • defaultTitle : String required
  • overview : String
  • titles : Array
    • name : String
    • countryCode : String ISO Alpha 3 uppercase
  • releaseDates :
    • date : Date
    • countryCode : String ISO Alpha 3 uppercase
  • versions :
    • number : String
    • date : Date
    • descriptione : String
  • metacritic :
    • score : Number
    • url : String
  • editors : Array of ObjectId, need to be an existing Editor id
  • developers : Array of ObjectId, need to be an existing Developer id
  • genres : Array of ObjectId, need to be an existing Genre id
  • paltforms : Array of ObjectId, need to be an existing Platform id
  • media : Array
    • boxArt : Array
      • front : String
      • rear : String
    • thumbnails : Array of String
    • logos : Array of String
    • banners : Array of String
    • fanArts : Array of String
    • screenshots : Array of String
    • trailers : Array of String
  • percentage : Number valorized when a games list is return
  • creationDate : Date auto generated once
  • updateDate : Date auto generated at each update

Licence

Datagamer is distributed under the MIT License.

datagamer-api-v2's People

Contributors

wifsimster avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

pengbai

datagamer-api-v2's Issues

Add version to game info

New versions attribute :

{versions: [{number: "gameVersion", date: "releaseDate", description: "whatsNew"}]}

gameVersion : Alphanumeric
ie : alpha-preview, beta release, 1.0, 1.21.10, ...

releaseDate : Date

description : String

Prevent games doublon

There are still doublon created in database.

Maybe mutual access can still create doublon when searching in the same time.

Perhaps, add a CRON to clean up the database ?

Publishing guidelines

(This is a copy of the previous issue, it stills sums up pretty much some of my questions)

Hi. I don't know if it's the right place to talk about the current online version but here are some precisions I think these should be cleared for a better future :

  • Multiples games have different names abroad the different release zones. Of course, japanese ones are the most frequent (ahem Pocket Monsters became Pokémon out of Japan) but some changes are too done between the PAL and NTSC zones (Contra became Probobector in PAL IIRC). Changes should be made to support naming for different regions or making aliases and redirect to a specific version (for instance US NTSC) or it would make something like a half-doublon.
  • Same for release dates. Different regions and different release dates.
  • One user, knowing the month but not finding the exact date could set only the month/year and not the day.
  • What about early access/constant developpment games or physical only games? Should we put the first beta release date or wait until the 1.0 is out to write it?
  • Something that's frontend independant but still related : what's the current rules to upload a picture as cover? I'm still wondering how I could support them with the Haxe frontend.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.