What's API GAME?

API integration enables your game to report any score or statistic.

How to load API (AS2)

Implement

System.security.allowDomain("poszkole.pl");
var PoszkoleAPI:MovieClip = _root.createEmptyMovieClip("PoszkoleAPI", _root.getNextHighestDepth());
var PoszkoleAPI_Loader:MovieClipLoader = new MovieClipLoader();
PoszkoleAPI_Loader.loadClip("http://poszkole.pl/poszkoleAPI_AS2.swf",PoszkoleAPI);
				

All of this code should be executed at the very beginning of the game.

Create an empty movie clip, and load PoszkoleAPI SWF into it. You'll use this variable to access the API. Make sure you can access it from wherever you will later call submitScore.

How to submit score:

			
PoszkoleAPI.submitScore("key",value);
				

Please use game key generated at our website instead of literal "key". Take a look at Sample code tab.

You need to provide the score or time represented by the "value" variable.

Library API_AS2

http://poszkole.pl/poszkoleAPI_AS2.swf

How to load API (AS3)

Implement

import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.events.Event;
import flash.net.URLRequest;

Security.allowDomain("poszkole.pl");
var parameters:Object = LoaderInfo(root.loaderInfo).parameters;
var PoszkoleAPI:MovieClip;
var PoszkoleAPI_Loader:Loader = new Loader();
PoszkoleAPI_Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, PoszkoleAPI_loadComplete);
PoszkoleAPI_Loader.load(new URLRequest("http://poszkole.pl/poszkoleAPI_AS3.swf"));
function PoszkoleAPI_loadComplete(e:Event):void {
  PoszkoleAPI = e.currentTarget.content;
}

this.addChild(PoszkoleAPI_Loader);
				

All of this code should be executed at the very beginning of the game.

Create an empty movie clip, and load PoszkoleAPI SWF into it. You'll use this variable to access the API. Make sure you can access it from wherever you will later call submitScore.

How to submit score:

			
PoszkoleAPI.submitScore("key",value);
				

Please use game key generated at our website instead of literal "key". Take a look at Sample code tab.

You need to provide the score or time represented by the "value" variable.

Library API_AS3

http://poszkole.pl/poszkoleAPI_AS3.swf

Preparation of a signature (SIG)

Build the array

tab[_key] = your_private_key
tab[_auth_sid] = your_auth_sid
tab[game_time] = 123
			
Sort array
tab[_auth_sid] = your_auth_sid
tab[_key] = your_private_key
tab[game_time] = 123
			
Build string
_auth_sid/your_auth_sid/_key/your_private_key/game_value/123/
			
Generated md5
_sig = md5( '_auth_sid/your_auth_sid/_key/your_private_key/game_value/123/' );
			

Services API GAME

user.isAuth

Example Request

curl "http://poszkole.pl/api/user.isAuth/_auth_sid/your_auth_sid/_sig/your_sig/"

Example Return JSON:

{
  "auth":true
}
			
Request Params:
Required Name Type Description
required _sig string Signature of the generated data
required _auth_sid string Auth SID transmitted to the game
Response Params:
Name Type Description
auth boolean True/False

user.getInfo

Example Request

curl "http://poszkole.pl/api/user.getInfo/_auth_sid/your_auth_sid/_sig/your_sig/"

Example Return JSON:

{
  "nick":"user name",
  "sex":"male",
  "game_value":123
}
			
Request Params:
Required Name Type Description
required _sig string Signature of the generated data
required _auth_sid string Auth SID transmitted to the game
Response Params:
Name Type Description
nick string User nick name
sex string male/female
game_value integer Points gained in the game / Time playing in the game (millisecond)

game.save

Example Request

curl "http://poszkole.pl/api/game.save/_auth_sid/your_auth_sid/_sig/your_sig/game_value/123"

or

curl "http://poszkole.pl/api/game.save/_auth_sid/your_auth_sid/_sig/your_sig/game_value/123"

Example Return JSON:

{
  "success":true
}
			
Request Params:
Required Name Type Description
required _sig string Signature of the generated data
required _auth_sid string Auth SID transmitted to the game
required game_value integer Points gained in the game / Time playing in the game (millisecond)
Response Params:
Name Type Description
auth boolean True

game.getLinkRank

Example Request

curl "http://poszkole.pl/api/game.getLinkRank/_auth_sid/your_auth_sid/_sig/your_sig/"

Example Return JSON:

{
  "link":"http://poszkole.pl/"
}
			
Request Params:
Required Name Type Description
required _sig string Signature of the generated data
required _auth_sid string Auth SID transmitted to the game
Response Params:
Name Type Description
link string Url to page rank

Error API Code

PS-01 - SIG or game_id is empty

Example Return JSON:

{
  "error":true,
  "code":"PS-01",
  "description":"SIG or game_id is empty"
}

PS-02 - Need Authorization

Example Return JSON:

{
  "error":true,
  "code":"PS-02",
  "description":"Need Authorization"
}
			

PS-03 - Game does not exist or game is not active

Example Return JSON:

{
  "error":true,
  "code":"PS-03",
  "description":"Game does not exist or game is not active"
}
			

PS-04 - Param "game_value" not defined

Example Return JSON:

{
  "error":true,
  "code":"PS-04",
  "description":"Param game_value not defined"
}
			

PS-05 - Param "game_value" is an invalid type

Example Return JSON:

{
  "error":true,
  "code":"PS-05",
  "description":"Param game_value is an invalid type"
}
			

PS-06 - Param "_sig" invalide

Example Return JSON:

{
  "error":true,
  "code":"PS-06",
  "description":"Param _sig invalid"
}