Skip to content
Megadynamite edited this page Jul 20, 2021 · 2 revisions

Welcome to the BF4-API-Documentation wiki, most of the data should be placed here with the exception of raw files.

As the readme says, this is a side project. Most of the time it's a lot of effort for me to document these so even most things I have extensive experience with are undocumented. Leave an issue if you need anything and I may notice eventually.

Headers

User-Agent: [Put something unique here],
Content-Type: application/x-www-form-urlencoded; charset=UTF-8,
X-AjaxNavigation: 1

Note that I'm horrible at webdev so don't expect me to know what these do.

It's always suggested that you provide a user-agent when making requests to identify yourself. The Battlelog site does not mandate them so you could remove this with no consequences but they could randomly enforce it on one endpoint or in the future.

Without the content type header I would receive a 200 response but then the data would be entirely missing. UTF-8 is a normal encoding scheme.

As for X-AJAX, I am incapable of explaining the mechanism but without this header, any direct requests to webpages will return html which I did not want to parse, this header causes them to return json.

You can add any other headers you would like, these just seem to be the bare minimum to return reasonably usable data.