Skip to content

Sending Commands with Web API

SirBitesalot edited this page Feb 12, 2017 · 1 revision

In guide we will send an Example Command to the server using the Chrome Extension Postman. Your server and Web API should be configured completely. Open Postman and select POST (dropdown list next to URL field) as url use: https://localhost:51234/AvorionServerManager/api/Commands (Replace port if necessary) Add the Authorization header and a Content-Type Header with the value application/json:

Now go to the "Settings" folder of the manager. There are three example commands. We will use "Broadcast.json" open it (use notepad++ for example) and copy all content. Now switch back to Postman and select the tab Body (located under Url field) set the type to raw and paste the content you copied before. Postman should now look like this:

Now before you click on "Send" verify that the server and the WebApi are started. To see the effect of the command you should join your server.(this can be done on another pc) Now hit send and look at the Chat in the Game Client. There should be a Message:

To modify the Command edit values in the Parameters The first value, in this case "WebRequestSender", is the Sender name. The second value "0" is the messagetype. This should normally not be changed The last value "Hello from webrequest" is the content of the message. An Example:

Result:

The Stop and Save command can not be modified. To start the server you need the url: (change port if necessary) And make a post request with Content-Type text/plain and the body "startServer":

You will get a simple status 200 ok Response and if the server was not already running it will start.

Clone this wiki locally