/go-confluence

Go package for working with Atlassian Confluence Server REST API

Primary LanguageGoApache License 2.0Apache-2.0

PkgGoDev GoReportCard GitHub Actions CI Status GitHub Actions CodeQL Status Codebeat badge

InstallationUsage exampleBuild StatusLicense


go-confluence is a Go package for working with Confluence REST API.

Currently, this package support only getting data from API (i.e., you cannot create or modify data using this package).

Installation

Make sure you have a working Go 1.17+ workspace (instructions), then:

go get -d github.com/essentialkaos/go-confluence/v5

For update to latest stable release, do:

go get -d -u github.com/essentialkaos/go-confluence/v5

Usage example

package main

import (
  "fmt"
  cf "github.com/essentialkaos/go-confluence/v5"
)

func main() {
  api, err := cf.NewAPI("https://confluence.domain.com", "john", "MySuppaPAssWOrd")
  api.SetUserAgent("MyApp", "1.2.3")

  if err != nil {
    fmt.Printf("Error: %v\n", err)
    return
  }

  content, err := api.GetContentByID(
    "18173522", cf.ContentIDParameters{
      Version: 4,
      Expand:  []string{"space", "body.view", "version"},
    },
  )

  if err != nil {
    fmt.Printf("Error: %v\n", err)
    return
  }

  fmt.Printf("ID: %s\n", content.ID)
}

Build Status

Branch Status
master (Stable) CI
develop (Unstable) CI

License

Apache License, Version 2.0