NAV
python

Introduction

Welcome to the INTERNAL Corporate Clash API Documentation! Do not share this outside of the team or retain it after leaving.

API requests here intended for the game will have an example utilizing the built-in rpc client, which automatically prepends the API base URL and handles the header requirements, including realm and authentication. Other API requests will use normal requests syntax with the full url of API resources.

User-agent requirement

Please set an appropriate user-agent header:

user-agent: MyCoolSite/1.0.0

also set the realm for any game-initiated APIs, although these should be set by default by the premade RPC Client.

x-realm: production
#x-realm: qa

Please include an identifiable user-agent with requests. We don't gate the user-agent besides preventing fake scrapers ( eg. pretending to be GoogleBot). If we can't get in touch with you and your client is abusing our API we might block it to ensure functionality for other API consumers.

V1 gameserver

The authorization header must be set with the value being the current API key.

Clubs: add club name

_response = simbase.air.rpcClient.call('gs/names/club/+', json={"avid": int(avid), "name": REQ_CLUB_NAME})
if _response.status_code != 200:
  # error handle
  return
out_json = _response.json()
requestid = out_json.get("responseid")

JSON:

{
  "status": true,
  "reason": "",
  "requestid": 4657439853
}
# ERROR
{
  "status": false,
  "reason": "name field had error something"
}

HTTP Request

POST https://corporateclash.net/api/v1/gs/names/club/+

JSON post body:

Parameter type Description
avid integer avid in (big)integer form
name string requested name.

Return Object

Returns the following json:

Parameter type Description
status boolean Whether or not the request succeeded.
reason string Reason for a failure. Will be a 0-length string if status is true.
requestid integer? the snowflake ID. requestid will not be present if status is false.

Clubs: check club name

stored_snowflake = 4657439853  # `requestid` from above
_response = self._air.rpcClient.call('gs/names/club/check/' + str(stored_snowflake), {}, "GET")
if _response.status_code != 200:
  # error handle
  return
out_json = _response.json()

JSON:

# REJECTED
{
  "status": true,
  "reason": "",
  "deny_reason": "No political topics",
  "id": 4657439853,
  "approved": false,
  "pending": false,
  "rejected": true
}
# PENDING
{
  "status": true,
  "reason": "",
  "deny_reason": "",
  "id": 4657439853,
  "approved": false,
  "pending": true,
  "rejected": false
}
# APPROVED
{
  "status": true,
  "reason": "",
  "deny_reason": "",
  "id": 4657439853,
  "approved": true,
  "pending": false,
  "rejected": false
}
# ERROR for the ID not being found
{
  "status": false,
  "reason": "bad id",
  "deny_reason": "",
  "id": 4657439853,
  "approved": false,
  "pending": false,
  "rejected": false
}

HTTP Request

GET https://corporateclash.net/api/v1/gs/names/club/check/:SNOWFLAKE

Return Object

Returns the following json:

Parameter type Description
status boolean Whether or not the request succeeded.
reason string Reason for a failure. Will be a 0-length string if status is true.
deny_reason string If rejected, the string reason for the denial. If possible, show this to the user (it'll also be in their email).
id integer the snowflake ID you passed in, in case you need it.
approved boolean Decision status
pending boolean Decision status
rejected boolean Decision status

Errors

The Kittn API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The kitten requested is hidden for administrators only.
404 Not Found -- The specified kitten could not be found.
405 Method Not Allowed -- You tried to access a kitten with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The kitten requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.