Update Mod API: Difference between revisions

From Warzone Wiki
Jump to navigation Jump to search
Created page with "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 -- u..."
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 11: Line 11:
To use the API, POST some JSON to https://www.warzone.com/API/UpdateMod?ModID=###&APIToken=XXX
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 ID of your mod and your [[Get API Token API|API Token]] 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:
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:
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 ==

Latest revision as of 20:53, 4 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 API Token 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.