You can install the package by using go get
in your Go Project.
go get -u github.com/Ju0x/palworldapi
This will pull the latest release.
First you need to initialize a new PalworldAPI instance with credentials.
pal := palworldapi.New("http://localhost:8212", "admin", "admin password")
Typically the username is admin
.
The AdminPassword
is set in the Server Configuration. (How to configure the Palworld Server)
The REST API must be activated on the server with the RESTAPIEnabled=True
option.
With the palworldapi instance you are now able to use the wrapper functions.
package main
import "github.com/Ju0x/palworldapi"
func main() {
pal := palworldapi.New("http://localhost:8212", os.Getenv("USERNAME"), os.Getenv("ADMIN_PASSWORD"))
// Sends the message to the server globally
pal.Announce("Hello World!")
}
Then run it
USERNAME=admin ADMIN_PASSWORD=your_admin_password go run .
The result should look like this:
![](https://private-user-images.githubusercontent.com/67586349/376063228-d2d986da-5295-4a3d-ad83-57ea1cd058d4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMDM5MTAsIm5iZiI6MTczOTEwMzYxMCwicGF0aCI6Ii82NzU4NjM0OS8zNzYwNjMyMjgtZDJkOTg2ZGEtNTI5NS00YTNkLWFkODMtNTdlYTFjZDA1OGQ0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDEyMjAxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEwYjA4MWQ1ZGU3ZjBiMDFjZGUyNmU4ZjkzZDRhYzExYzQ1MjYzNjg1MGY3YWYxNTQ0OTE0YjE0ZWU2MDM3MDYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.lRTP4cL_8FBZkw74oT1ddrfINkvDq6yysovk52EdQcY)
You can find some examples here