In principle, an API is a way to define endpoints of data on a server which a client may access over Hyper Text Transfer Protocols (HTTP) that we will use. Many of the most common HTTP methods we see today are GET, POST, and DELETE.
Generally, a client will start a request and response handshake with the server via the server API. A process is started which may be a request or anything that shall trigger an external event for the API.
A server on which the API is running will handle that handshake event. The event may involve authentication, validation, retrieval, deletion, updating, or manipulation of a data set.
- Endpoints are stand-alone user resource link (URL) to provide specific access to a resource or dataset.
- Methods indicates the operation called by the client to the API to perform an action.
- Parameters are a variable passed to the endpoint for instruction.
- Request header is a value representing details about request process, i.e. formatting of datasets or credentials.
- Body is the center piece for request and response handshake messaging. It contains the datasets of the resource or status codes.
- Response header is much like a request header, but for information about server response.
It is important to note the concept of web applications today run mainly on HTTP. Moreover, HTTP protocols began in the early 1960's with the Xanadu project by Ted Nelson and his team. HTTP was further developed and standardized by a team at the European Center for Nuclear Research (CERN) by Tim Burners-Lee to promote his World Wide Web Project (WWW) in the early 1990s with his Hyper Text Markup Language (HTML) to make information available. You may read more about HTTP standards on their website for specifications and documentation.
Regardless, we saw further development of our ability to interact with clients and servers around the mid-1990s
from Daniel Stenberg with his cURL library. Written in the C-language, it is the foundation
with which most of us interact with APIs across the WWW and you will find his library on just about any computer. Let us look at a basic example in your terminal by running the following: curl -X GET "https://api.alpha-strike.space/health"
As long as the server is running, you should receive a status code of 200 which represents that everything is 'OKAY' so to speak.
You will see many status codes, whether interacting with an API or just loading a URL. The most important codes are the following:
- Code: 100 means progress.
- Code: 200 means success.
- Code: 300 means redirection, sometimes cache (temporary storage) rules.
- Code: 400 means client side error.
- Code: 500 means server side error.
We shall list each endpoint and the corresponding command to retrieve information with our basis library cURL. Keep in mind our base url is https://api.alpha-strike.space/ for your reference. Note, that you may hide output by hitting the generate button again.
/health return the health of server. Example: curl -X GET "https://api.alpha-strike.space/health"
curl -X GET "https://api.alpha-strike.space/health"
/incident return all incidents, or by victim/killer name and system. Please note that you may add filters based on day, week, or month regarding the time stamps
curl -X GET "https://api.alpha-strike.space/incident"
/location return all systems, or by id and name.
curl -X GET "https://api.alpha-strike.space/location"
curl -X GET "https://api.alpha-strike.space/totals"
An outbound websocket on the server for latest mails. Remember, the base url is wss://api.alpha-strike.space/ws/ for your reference. It must be noted that websockets aren't serialized in the traditional sense. You will parse it as a string or binary, in our case it will be a string.
/mails return a message, and the latest incident on the frontier.wscat -c "wss://api.alpha-strike.space/ws/mails"
I shamelessly promote our work for developing this website to host incident mails from the game Eve Frontier. The development of this website is unusual in the sense that most have been written in Python, PHP, or some sort of Java framework. I took a different route by utilizing C++ for handling a PostgreSQL database and HTML for the beautiful display in conjunction with NGINX and Cloudflare for handling requests. The purpose of this endeavor is to give myself confidence handling data across my two favorite languages, support a website in its display, and learn new things while giving those who play Eve Frontier a place to show off their criminally good pew pew skills. Good luck, have fun o7.