Skip to content

BaseMax/SampleGameAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Sample Game API

A tiny implement such as google play game web service using PHP.

Features

  • API
  • Create app, game
  • Create user (email, random password just for one time)
  • Submit score

Game API

createApp

http://localhost/matno4/?method=createApp

{ status: "failed", message: "Cannot create an app without passing package name!" }

http://localhost/matno4/?method=createApp&packageName=org.max.blog

Without headers:

{ status: "failed", message: "This token and key is not valid!" }

http://localhost/matno4/?method=createApp&packageName=org.max.blog

With headers:

{ status: "success", message: "successfully created!", result: { publicKey: "ksqmpzlduf80i5s9ljhce2g9n9yurxl0kfw6avrdgftm4zzqyn", token: "qn2vwnad16rjfcxb6vu9u3neb153ca7wotbacphyl6dklj5it8"	} }

again refresh:

{ status: "failed", message: "Cannot create an app with dublicate package name!" }

createUser

http://localhost/matno4/SampleGameAPI/src/?method=registerUser

{ status: "failed", message: "Cannot create a user without passing device, version and packageName!" }

http://localhost/matno4/SampleGameAPI/src/?method=registerUser&packageName=org.max.blog&version=1.0.0&device=samsung-SL10&email=maxmaxmax456@asrez.com

{ status: "success", message: "successfully created!", result: { publicKey: "n1owugbezggmgdubwzbwni9jhq7t2xqqjj5heywrbwt4k1a1jo", token: "6rrnr9dmvb1cwfjva6yhoot3ydc8tkvcbwtj96m5pia2tzbgz7"	} }

Again reload:

{	status: "failed",	message: "Cannot create a user with dublicate email address!" } 

loginUser

http://localhost/matno4/SampleGameAPI/src/?method=loginUser&packageName=org.max.blog&version=1.0.0&device=samsung-SL10&email=max@asrez.comxxxxxxx

{ status: "failed", message: "Email not exists!" }

http://localhost/matno4/SampleGameAPI/src/?method=loginUser&packageName=org.max.blog&version=1.0.0&device=samsung-SL10&email=max@asrez.com

{ status: "success", message: "successfully created!", result: { email: "max@asrez.com"	} }

authUser

http://localhost/matno4/SampleGameAPI/src/?method=authUser&packageName=org.max.blog&version=1.0.0&device=samsung-SL10&email=max@asrez.com&code=4561

{ status: "success", message: "Wellcome!", result: { session: "vb9jbwuuwh1qyr07yp6kd8dwjkf2xz18d29vx8b0p20q4kvu1v"	} }

and reload:

{ status: "failed", message: "You not have this premission to do this task!" }

submitScore

http://localhost/matno4/SampleGameAPI/src/?method=submitScore&packageName=org.max.blog&value=500

{ status: "failed", message: "Cannot verify you without passing device, version, packageName, email, session and value!" }

http://localhost/matno4/SampleGameAPI/src/?method=submitScore&packageName=org.max.blog&version=1.0.0&device=samsung-SL10&email=max@asrez.com&session=vb9jbwuuwh1qyr07yp6kd8dwjkf2xz18d29vx8b0p20q4kvu1v&value=500

{ status: "success", message: "Great, Enjoy!" }

highScore

http://localhost/matno4/SampleGameAPI/src/?method=highScore&packageName=org.max.blog

{ status: "success", message: "You get list as below...", result: { list: [	{ id: "5", appID: "2", userID: "1", session: "vb9jbwuuwh1qyr07yp6kd8dwjkf2xz18d29vx8b0p20q4kvu1v", value: "1648", datetime: "2020-03-01 03:08:55"	},	{ id: "4", appID: "2", userID: "1", session: "vb9jbwuuwh1qyr07yp6kd8dwjkf2xz18d29vx8b0p20q4kvu1v", value: "840", datetime: "2020-03-01 03:08:53"	},	{ id: "3", appID: "2", userID: "1", session: "vb9jbwuuwh1qyr07yp6kd8dwjkf2xz18d29vx8b0p20q4kvu1v", value: "500", datetime: "2020-03-01 03:08:43"	} ], count: 0, hightest: null, lowest: null	} }

But it's not secure, so i did change PHP code and results to:

{ status: "success", message: "You get list as below...", result: { list: [	{ value: "1648"	},	{ value: "840"	},	{ value: "500"	} ], count: 0, hightest: null, lowest: null	} }

Max Base

My nickname is Max, Programming language developer, Full-stack programmer. I love computer scientists, researchers, and compilers. (Max Base)

Asrez Team

A team includes some programmer, developer, designer, researcher(s) especially Max Base.

Asrez Team

About

A tiny implement API for game apps with a web service using PHP.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published