WorldServer 11.3 Customizing the REST API

The following article in the SDL WorldServer 11.3 Developer Documentation provides an explanation on how to customize the REST API: https://docs.sdl.com/LiveContent/content/en-US/SDL%20WorldServer%20Developer%20Documentation-v1#addHistory=true&filename=GUID-316AC991-323A-4FE4-846D-C738A7182E45.xml&docid=GUID-834DC279-3978-4D27-A5F8-966BA0A8A679&inner_id=&tid=&query=&scope=&resource=&toc=false&eventType=lcContent.loadDocGUID-834DC279-3978-4D27-A5F8-966BA0A8A679.

For the most part the instructions are clear and easy to follow. However, there is one missing piece of information that would have been helpful to include.

One of the steps explains how to upload a .jar file containing custom REST API code. The step says the following:

"Upload the .jar file into WorldServer. Use any REST client you want. To upload the .jar file, make a POST request to <protocol>://<ws-host>:<ws-port>/ws-api/v1/customizations/api?token=<sessionId>. Use a form-data body."

I attempted to do this, but received the following error response:

{
    "errors": [
        {
            "code"400,
            "type""VALIDATION",
            "message""File with size 0 is too small."
        }
    ]
}

After some trial and error I discovered that even though I was including the .jar file in a form-data body, I was not using the correct key. The upload succeeded when I sent the .jar file with the key name "file".

Hopefully this will be helpful to someone else who runs into the same issue I saw.