Skip to content

Document API (on site or here?) #8

@bloerwald

Description

@bloerwald

As a non-windows user, but still a lazy person, I had to reverse engineer the API. It boiled down to

#!/bin/bash
set -euo pipefail
apiKey="${1}"
luaFile="${2}"
curl \
  --user-agent "WoWthing Sync" \
  --header "Content-Type: application/json" \
  --header "Content-Encoding: gzip" \
  --data-binary @<(jq --raw-output \
                      --arg data "$(cat "${luaFile}")" \
                      --arg apikey "${apiKey}" \
                      '{"LuaFile": $data, "ApiKey": $apikey}' <<<'{}' | \
                      gzip) \
  https://wowthing.org/api/upload

i.e.


/upload

  • Requires Content-Type application/json.
  • Requires Content-Encoding gzip.
  • Content shall be a json blob with {"LuaFile": …, "ApiKey": …} where
    • LuaFile is the WoWthing_Collector.lua file content.
    • ApiKey is found in your account's settings page.

I feel this should probably be in some by-default-hidden block on the /upload page. No real need in hiding it.

One could engineer this into a docker container with inotify-watch for the lua file etc to have a platform-agonistic sync application, but meh. I personally will just manually run it every once in a while. To me, documenting the API somewhere would be enough.

Of course, dumping the above script in this repo is also a good thing for people like me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions