Skip to content

Ju0x/palworldapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Palworld API Wrapper

GitHub License Codacy Badge Go Report Card

Easy to use wrapper for the Palworld REST API

Set up a Palworld Server

Read the API Docs

Installation

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.

Usage

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.

First Hello World

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:

Examples

You can find some examples here