Skip to content

truenas/api_client_golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Join Discord Join Forums File Issue

TrueNAS Go Websocket Client

About

This is a an example for using the TrueNAS Websocket API using Go. It parallels the Python TrueNAS API client, found here: https://github.com/truenas/api_client

It is JSON-RPC 2.0 based, so it doesn't use the ws://truenas.address/websocket API.

Getting Started

On any system with Go installed (see https://go.dev/doc/install), clone this repo.

Then build the truenas_go command:

go build truenas_go.go
go install truenas_go.go

Example run:

export TRUENAS_API_KEY="1-xxxxxxxxx" # Create this on your TrueNAS, and copy the result here
truenas_go --uri ws://ip_of_your_truenas/api/current --api-key=${TRUENAS_API_KEY} --timeout 20 --method system.info

More command line examples in EXAMPLES.md

Code examples in examples/

See examples/app_upgrade/app_upgrade.go for an example that uses a long running job and progress reporting.

Helpful Links

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages