Search Player

My player

Ads

Crysis 2 Stats JSON API

c2stats.com offers an API for fetching all Crysis 2 Stats data from our database.
This API can be used by software engineers to integrate Crysis 2 Stats into their software.
If you use this API, please set a link back to c2stats.com like: Powered by c2stats.com
Commercial use is not permitted.

Accessing the API

You can access the API via. HTTP POST over following URL:
http://c2stats.com/api/[Platform]
As [Platform] you can use following:
  • pc
Cross domain access is allowed: http://c2stats.com/crossdomain.xml
Please cache the data on your side and don't call this API on every hit on your website.
I recommend to access this API via. cronjobs. Sometimes this API can return a HTTP Status 500, this is when it's overloaded.

Get Crysis 2 stats of players

URL: http://c2stats.com/api/[Platform]
POST Data: request=getlist&players=[PlayerList]
  • [PlayerList] is a comma separated list of player names e.g. 1ApRiL,DocDurchschnitt
Example POST Data: request=getlist&players=d1ApRiL,DocDurchschnitt
Maxiumum player limit is 100


The returned data looks like this:
{
	"players":{
		"d1ApRiL":{
			"name":"d1ApRiL",
			"platform":"pc",
			"xp":106263,
			"xp_rank":50244,
			"power":42987,
			"status":1,
			"queue":{
				"pos":-1,
				"code":2
			}
			.....
		},
		"DocDurchschnitt":{
			"name":"DocDurchschnitt",
			"platform":"pc",
			"xp":1058873,
			"xp_rank":5540,
			"status":1
			......
		},
		.....
	}
}
	

Updating of the player

If the last check of a player is older than 1 hour, the API will automatically try to insert the requested player into the update queue.
You see this if queue.pos for an player is set and zero or above.
If queue.pos is lower than zero the operation was progressed and queue.code shows the status. If players you requested are not in our database, they will be looked up automatically.

Following queue.code are possible:
  • 0 - operation is in progress, no result yet
  • 1 - operation was successful, player updated
  • 2 - operation was successful, player not found
  • 3 - operation was successful, player not allowed, hacked stats

PHP Example

<?php
$url = 'http://c2stats.com/api/pc';
$postdata = 'request=getlist&players=d1ApRiL,DocDurchschnitt';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
$data = curl_exec($ch);
curl_close($ch);

$data = json_decode($data,true);

print_r($data);

?>

API Tester

request=
players=