HRCodWar - API

Reference for API via web for developers.
What is the API web?

It gives any user an opportunity for developing applications related with the campaign accessing in a simple way to any data stored related with the mission. It is essentially a simplified RESTFul where the only possible operation is get information. For those not familiarized with that class of web services its a mean of getting information through http calls to a script. It will return an json object with the gathered information coded in UFT-8

Parameters

The api url is the following: http://www.halconesrojos.com/hrcodwar/api/datos.php

All parameters must be passed via url (get). It is order independent:

  • c : The troop key to inquire into.
  • n : The nº of the flown mission.
  • f : The name of the file to inquire into.
In the following example, we read all recorded events of mission nº 2:

http://www.halconesrojos.com/hrcodwar/api/datos.php?c=password&n=2&f=eventos

The result
The returned json objet has the following variables:
  • r : It is the result of the inquire, boolean value, true o false.
  • m : It contains a value only in the case of r==false, it returns the message error.
  • d : It is the data, the read file with its own structure.
The files

HRCodWar stores in the dedicated server as well as in the web all files needed for the campaign. That way, it is possible to access any data we might need about it. As explained before, no database is used, there is a collection of json files stored in different directories. These are the files we can inquire into, some will be accessible for anyone because no confidential data is stored there like for instance por ej. pilotos.json. Nevertheless others line eventos.json will be filtered and only events of the inquiring side could be read.

Every file stores data following a special scheme with all the fields needed to store information while the server is running but meaningless for the API. Nevertheless, all fields will be read and returned even if empty. Next, we document all fields useful for a statistical use, the remaining fields are for internal use and will not be referenced (but will be returned).

The exact name of the files to inquire into with the parameter f (common and public ones) and the returned data in the json found in d are:

The accumulated score for each side.

  • bando: 1 allied, 2 axis.
  • puntuacion: The score in this mission.
  • puntuacion_anterior: The score in the previous mission.
  • puntuacion_diferencia: The difference in points between missions.
  • tendencia_actual: +1 or -1 according to the difference.
  • tendencia: The sum of the actual tendencies in each mission.

It stores the scores of all squadrons .

  • nick: The nickname of the squadron.
  • bando: 1 allied, 2 axis.
  • puntuacion: The score of the squadron in this mission.

It stores the basic statistics of all pilots.

  • nombre: The nickname of the pilot.
  • bando: 1 allied, 2 axis.
  • escuadron: The nickname of the squadron he belongs to.
  • unidades_clases_destruidas: Collection of several json values with the class of the destroyed plane and the amount of them, ex: {"BlenheimMkIV":1,"SpitfireMkIIa":5}
  • unidades_nombres_destruidas: Collection of several json values with the name of the destroyed elements and the amount of them, ex: {"BlenheimMkIV#77":3,"Factory nº 5":1,"nickpilot":2}
  • ndespegues: Nº of registered takeoffs.
  • ncapturado: Nº of times captured.
  • nmuertes: Nº of registered deaths.
  • nmisionmuerto: Nº of the mission when the dead took place (if the single life mode is turned on).

Stores the status of all ports.

  • coord: Another json object with the x/y coordinates of the sector where the port lies, it refers the upper left corner.
  • sector: Name of the sector of the port.

Full name of files to inquire into with parameter f with sensitive information for each side and data returned in the json file found in d are:

Information about airbases of the inquired side.

  • escuadron: Nickname of the squadron it belongs to.
  • nombre: Name of the airbase.
  • sector: Name of the sector where it can be found.
  • bando: 1 allied, 2 axis.
  • coord: Another json object with the x/y coordinates
  • recursos_fuel: Kilograms of fuel.
  • recursos_municion: Ammunition, untis.
  • recursos_bombas: Bombs, units.
  • recursos_reparacion: Repair kits, units.
  • aparatos_disponibles: Collection of several json values with airplanes available in the airbase:, ex: {"BlenheimMkIV":10,"HurricaneMkI_100oct":12}
  • aparatos_en_reparacion: List of several json values with airplanes under rapair in the airbase:, ex: ["SpitfireMkIIa@5","BlenheimMkIV@202"]
  • prestamos: Number of planes in the airbase available to lend.
  • id: It corresponds to the number of the base, used in chat commands.

Information about the factories of the inquired side.

  • escuadron: Nickname of the squadron it belongs to.
  • coord: Another json object with the x/y coordinates.
  • destruida: Boolean value that shows if it is destroyed for the current mission.
  • mision_destruida: Number of the mission when it was destroyed.
  • sector: Name of the sector where it can be found.
  • bando: 1 allied, 2 axis.
  • id: It corresponds to the number of the factory, used in chat commands.
  • puntos: Creation points stored in this mission.
  • esastillero: Boolean value that shows if the factory is a shipyard or not.

Information about the refineries of the inquired side.

  • escuadron: Nickname of the squadron it belongs to.
  • coord: Another json object with the x/y coordinates.
  • destruida: Boolean value that shows if it is destroyed for the current mission.
  • mision_destruida: Number of the mission when it was destroyed.
  • sector: Name of the sector where it can be found.
  • bando: 1 allied, 2 axis.
  • id: It corresponds to the number of the refinery, used in chat commands.
  • fuel: Kilograms of fuel stored for the current mission.

Information about the power plants of the inquired side.

  • coord: Another json object with the x/y coordinates.
  • destruida: Boolean value that shows if it is destroyed for the current mission.
  • mision_destruida: Number of the mission when it was destroyed.
  • sector: Name of the sector where it can be found.
  • bando: 1 allied, 2 axis.
  • id: It corresponds to the number of the power plant, used in chat commands.

List of the allied surviving units in the mission.

  • nombre: Name of the allied unit.
  • escuadron: Nickname of the squadron it belongs to.
  • clase: Class of CLOD object.
  • bando: 11 allied, 2 axis.
  • coord: Another json object with the x/y coordinates where it is found, if the units is embarked it shows 0,0
  • vector: Unit facing direction, if the units is embarked it shows 0,0
  • sector: Name of the sector where it can be found, if embarked it is empty.
  • tipo: Type of unit, number, values: armor 0, cargo_ship 1, scort_ship 2, barge_ship 3, aaa 4, aaa_bow 5, aaa_stern 6, artillery 7, transport column 8
  • embarcable: Boolean value indicating if the unit can embark a cargo ship or not.
  • embarcada: If the unit was embarked, the name of the cargo ship that carried it.
  • unidades_embarcadas: If it is a cargo ship. a list with the name of the units being carried aboard.
  • carga: If it is a transport column (type 8), the transported cargo type and quantity.
  • mision_movida: The number of the mission when it was moved.

List of the destroyed units in that mission, every item stores:

  • nombre: The name of the unit.
  • escuadron: The nickname of the squadron it belongs to.
  • clase: The CLOD object class.
  • bando: 1 allied, 2 axis.
  • coord: Another json object with the x/y coordinates.
  • vector: Unit facing direction.
  • sector: Name of the sector where it can be found.
  • tipo: Type of unit, number, values: armor 0, cargo_ship 1, scort_ship 2, barge_ship 3, aaa 4, aaa_bow 5, aaa_stern 6, artillery 7, transport column 8
  • embarcada: If the unit was embarked, the name of the cargo ship that carried it.
  • unidades_embarcadas: If it is a cargo ship. a list with the name of the units being carried aboard.
  • causantes: Description of the damaging agents.
  • hora_destruida: Time of the mission when it was destroyed.

List of registered events in that mission.

  • mision: Number of the event mission
  • bando: 1 allied, 2 axis.
  • tipo: An integer identifying the type of event. Those can be found reading the following file here (in json format too).
  • coord: A json object with the x/y coordinates where the event takes place.
  • sector: Name of the sector where the event takes place.
  • clase: Object class associated with the event.
  • nombre_origen: Identifying name of the entity causing the event.
  • texto: Additional information for each event, used for composing the briefing.
  • hora_destruida: Time of the mission when it happened.

Mistakenly named mission briefing because it is a simple report of all events. It is shown in the web page and uses json events for its composition.

  • bando: 1 allied, 2 axis.
  • texto: Arbitrary description (real, dramatic and, sometimes, funny) of the event.