Creative Golf OpenAPI
Examples 1.0.0 · Protocol 2

C# OpenAPI console example

Requires the .NET 10 SDK. Uses only framework libraries; no third-party NuGet packages.

Build and run

Open src/CreativeGolfOpenAPIExample.csproj in Visual Studio with .NET 10 support, or run from this folder:

Game on the same PC:

dotnet run --project src/CreativeGolfOpenAPIExample.csproj -c Release

Optional: game on another PC. Replace 192.168.1.100 with that PC's IP address. 4356 is the default game port.

dotnet run --project src/CreativeGolfOpenAPIExample.csproj -c Release -- 192.168.1.100 4356

The distributed example is source-only. bin and obj are created locally when you build. The GUI TestApp is the ready-to-run application included in the final package.

Try it

Run Creative Golf with OpenAPI selected. Only one client can connect at a time. Defaults are 127.0.0.1:4356; optional arguments select the game PC and port.

Connection failure waits for Enter to retry or Esc to exit. The menu appears after the server's hello:

1 - Send normal shot
2 - Send putt
3 - Set device Ready
4 - Set device Not ready
5 - Show current game state
0 - Disconnect and exit
m - Show this menu

Type a choice and press Enter. Text aliases shot, putt, ready, notready, state, quit, menu also work. Status sends only ballReady, without a reason prompt. With redirected UTF-8 input, a blank line retries; esc, an Escape character or EOF cancels the initial connection attempt.

TX / RX show sent / received JSON. Each shot has a new UUID. Not-ready commands are discarded, and another shot needs the previous result and a fresh ready state. No automatic reconnect, queuing or replay. State messages replace the full snapshot; omitted fields clear old values. The game may still reject a shot after advertising readiness.

Replace the two presets in src/Program.cs with new live measurements from your hardware. Device status is independent of game readiness. See the API reference for fields, units and results.