Skip to main content

Anywhere API (v2 API)

What

AsHopefully youit mayis suspect,now theclear that FileWave Anywhere (formerly called WebAdmin) functions by making API calls to the FileWave server.server; meaning Wethese same API calls can alsobe leverageused thisin APIscripts toor makeby callsother for3rd ourparty own purposes.tools.

When/Why

Typically we will wantPerhaps to make automated API calls from within Scripts ran on devices or 3rd party tools to GET or POST/PATCH/DELETE entries on the FileWave server.

How

In the main, the queries will look almost the same as the Command Line RESTful commands.  

Read a current Inventory Query

Imagine it was desirable to read an already existing Inventory Query with an ID of 191.  The below shows the Command Line API call, followed by the FileWave Anywhere API call.

Command Line:

curl -s  -H "Authorization: $auth" https://$server_dns:20443/inv/api/v1/query_result/191

FileWave Anywhere:

curl -s  -H "Authorization: $auth" https://$server_dns:/api/inv/api/v1/query_result/191

As indicated in an earlier API KB document, the FileWave Anywhere uses port 443 (default if not specified) and the URL has an additional '/api' at the beginning of the URL path.

In an example setup, both of these would report exactly the same output, which might look something like:

{
  "offset":0,
  "fields":
    [
      "Client_device_name"
    ],
  "values":
    [
      ["C02Z90WDLVDQ"],
      ["FW1063"],
      ["mac0001"],
      ["macadmin1"],
      ["mini"],
      ["ML1015VMNEWNAME"],
      ["ml1063"],
      ["Orac"],
      ["pro"]
    ],
    "filter_results":9,
    "total_results":9,
    "version":3
}

Send an MDM Command

Since FileWave Anywhere is a tool with a broader range of control, the API tooptions getextend databeyond fromjust FileWavebasic forqueries.  someAs externaljust system,one orexample, the below shows a method to dosend automationan ofMDM somecommand sort.to a device, in this instance a command to restart an Android device, based upon the Device ID:

How


curl -X POST "https://${server}/api/android/restart_devices" \
  -H  "Content-Type: application/json" \
  -H "authorization: ${auth}" \
  -d '{"device_ids": ["3aa9cea3eb7ea992"]}'

 

 

The documentation for this new API is available once you have authenticated to FileWave Anywhere...you simply go to https://my.server.name/api/doc to see the documentation as built by Swagger and OpenAPI (it is quite extensive).  Each action can be tested from the documentation directly as you'll see below, but be careful, some of the calls are destructive! 

API calls are not something to be taken lightly, and you should make 100% sure that you understand your intended actions before taking them.

WebAdminAPI.png

If wanting to call the API without a FileWave Anywhere session active, your header would be in the form of "Authorization: base_64_token" rather than the X-CSRFToken shown in the examples.

Digging Deeper

Because it can be a topic that can trip someone up it is important to note that API calls are done on TCP 443. You may see references to 20445 in some documentation, but that is the RESTful API (v1 API) and it is on TCP 20445 however you can make a small change in the URL for the API endpoint and use TCP 443 for all calls. Simply prepend /api/ on the URL and you can use TCP 443 for the /inv/ endpoint URLs.