Update Mod API: Difference between revisions

From Warzone Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 17: Line 17:
   {
   {
   "files": [
   "files": [
        {
        {
   "path": "Client_PresentMenuUI.lua",
   "path": "Client_PresentMenuUI.lua",
   "content": "..."
   "content": "..."
Line 32: Line 32:




The "content" field should be base64 encoded.
The "content" field should contain the entire contents of that file encoded as a base64 string.


== Compression ==
== Compression ==

Revision as of 08:49, 2 November 2022

The Update Mod API can be used by mod developers to assist in updating the mod's code and assets. This API provides a way to rapidly iterate on mod development -- updating the mod's code and seeing the results in the Warzone game itself.

This API is meant to be integrated into a IDE, such as Visual Studio Code, to allow for easily updating the mod.

A key feature of this API is that it notifies any Warzone clients using the mod that it's out of date, and then those Warzone clients will download the updated mod automatically and immediately.

Usage

To use the API, you must first have created a development mod (not public) through the Mod Development Console. After doing that, take note of the Mod ID shown here when clicking "Edit" next to that mod.

To use the API, POST some JSON to https://www.warzone.com/API/UpdateMod?ModID=###&APIToken=XXX

The ID of your mod and your Get API Token API are passed on the querystring, as shown.

The body of your post should be JSON that identifies all files that are to be included in your mod. Here's a sample of the format:

 {
 "files": [
        {
 		"path": "Client_PresentMenuUI.lua",
 		"content": "..."
 	}, {
 		"path": "Utilities.lua",
 		"content": "..."
 	}, {
 		"path": "SpecialUnitImages/img.png",
 		"content": "..."
 	}
 	
 	]
 }


The "content" field should contain the entire contents of that file encoded as a base64 string.

Compression

If desired, you can also pass "&Compressed=1" to the end of the querystring. If this is present, then the json body you post should be compressed with 7zip. This can be useful if your mod is very large as it will save on the upload bandwidth used.