Web Requests
Web Requests sends sector data from Guild Battlegrounds to your own server via HTTP request – as GET with URL parameters or as POST with a JSON or form body. What the server does with it (bot, spreadsheet, database) is up to you. For announcements straight into a Discord channel, use Discord Webhooks.
Opening
- Menu bar: Web Requests icon (see menu bar).
- In the Guild Battlegrounds window under the gear → Sending tab: as long as there is no profile, it shows “No profile available. Please create one” with an Open button.
The window never opens by itself.
Profiles
A profile describes one request: target, method and content. The Profiles list shows each profile's name, method and target URL. If there are none yet, it says “No profiles yet.”
New profile opens an empty form.
Creating a profile
When you switch the body format, the helper only replaces the template while it is empty or still identical to the default of the other format.
At the bottom are the buttons Cancel, Preview, Send test and Save. When saving, the helper checks:
- Name and target URL must be filled in, otherwise: “Please enter a name and a target URL!”
- The URL must start with
https://.http://localhostandhttp://127.0.0.1are allowed as well. The browser blocks otherhttp://targets as mixed content.
Body formats
Placeholders are inserted JSON-safe (quotes and special characters escaped), but without quotes of their own – you put those in the template. The body is sent as plain text, without Content-Type: application/json; in PHP you read it via php://input. Default:
{
"sector": "#name",
"battletype": "#battletype",
"time": #time,
"attrition": "#attrition",
"guild": "#guild",
"vp": "#vp",
"neighbors": "#neighbors",
"player": "#player",
"world": "#world"
}
One line per field in the format key=value. Empty lines and lines without = are skipped. The body is sent as application/x-www-form-urlencoded; in PHP the values end up in $_POST. Default:
sector=#name
battletype=#battletype
time=#time
attrition=#attrition
guild=#guild
vp=#vp
neighbors=#neighbors
player=#player
world=#world
Preview
Preview shows the method, the resolved URL and – for POST – the resolved body with these sample values (Send test uses the same ones):
If the resulting JSON body is not valid JSON, the preview adds “The body is not valid JSON.” The preview updates when the form opens and on Preview or Send test, not while you type.
No response (fire-and-forget)
Requests are sent without waiting for a response. The helper evaluates neither the response nor errors and always reports “The request was sent (the response is not evaluated).” Custom headers (for example for authentication) cannot be set.
Placeholders
The same placeholders as in the Discord templates apply:
Victory points, neighbors and attrition can still change until the sector opens; the values at the time of the click are sent.
Using it in Guild Battlegrounds
In the Guild Battlegrounds window, open the gear (see window buttons), switch to the Sending tab and pick a profile in the Web Requests section (Please choose = off). Save applies the selection.
After that, the live overview shows a Send via web request button in the list of upcoming sectors for every sector that doesn't belong to your guild. Click rows to select them; above the list you then get Send selected provinces via web request: one request per selected sector, sorted by opening time, with one combined success message.
Unlike Discord Webhooks there is no automatic sending – web requests are only sent on click.
Note
Guild Battlegrounds remembers the profile by its name. If you rename or delete a profile, the buttons disappear until you select the profile again in the Sending tab.
Settings
The window has no gear of its own. Which profile Guild Battlegrounds uses is set in the Guild Battlegrounds settings (see
FAQ
My server receives nothing.
The helper always shows the success message, even if the request fails. Check the URL in the
Saving says “Only https:// URLs (or http://localhost) are possible”.
The game runs over https, so the browser doesn't allow requests to unencrypted addresses. Use an https address, or http://localhost for testing.
My PHP script doesn't find the JSON values in $_POST.
JSON does not end up in $_POST. Read the body via php://input or switch the profile to Form data (in PHP: $_POST).
See also
- Discord Webhooks – announcements straight into a Discord channel, also automatically
- Guild Battlegrounds
- Window buttons
- Menu bar