Skip to content

Details

Post

This endpoint enables the sending of a POST request.
It serves the purpose of retrieving information about servers for any game.

Endpoint

/post/fetch
The endpoint serves as an API function designed to handle POST requests and retrieve pertinent details regarding servers specified in the request.
FETCH means that upon sending a POST request, the server responds back with comprehensive details about the servers you've mentioned, effectively fetching the requested information.


Data

The format of the body needs to be set as JSON 'Content-Type': 'application/json' only this is accepted

data = {
  servers => {
    "192.168.0.1:27015",
    "192.168.0.2:27015"
  }
}
This block initializes a data structure containing the necessary data to be sent in the request.
The servers field contains a list of server's addresses with their corresponding ports.


Url

url = 'https://gamequery.dev/post/fetch'
This line assigns a string representing the URL of the API endpoint where the request will be sent.
It specifies the location where the POST request containing the server data will be directed for processing.


Headers

Remember x-api-token, x-api-token-type, x-api-token-email are generated on the panel

headers = {
  'Content-Type': 'application/json',
  'Cache-Control': 'no-cache',
  'Accept': '*/*',
  'Accept-Encoding': 'gzip,deflate',
  'Connection': 'keep-alive',
  'x-api-token': 'TOKEN',
  'x-api-token-type': 'FREE OR PRO',
  'x-api-token-email': 'YOUR ACCOUNT EMAIL',
  'User-Agent': 'Mozilla/5.0 (compatible; GApiPlugin/1.0; +https://gamequery.dev)',
  'Authorization': 'Bearer apitestoken'
}
This block initializes a data structure, typically a dictionary or object, containing HTTP headers.
These headers provide additional information about the request, such as the content type, cache control, and authentication tokens.
They play a crucial role in communicating various aspects of the request to the server, ensuring proper processing and handling of the data being sent.


Response

response = requests.post(url, json=data, headers=headers)
This line sends a POST request to the specified URL with the provided data and headers.
It utilizes the requests.post() function to initiate the request, passing the URL, JSON (data), and headers (headers) as parameters.
Upon execution, this line captures the response returned by the server, which typically includes status information (e.g., success or failure) and possibly additional data relevant to the request.


Note

You can see the examples on Code Examples page,
Keep in mind those are just examples you need to generate your own key on https://gamequery.dev/api/generate