Page cover

๐Ÿ’พSpace

Get content for space

GET /wiki/rest/api/space/{spaceKey}/content

Deprecated, use Confluence's v2 API.

Returns all content in a space. The returned content is grouped by type (pages then blogposts), then ordered by content ID in ascending order.

package main

import (
   "context"
   "github.com/ctreminiom/go-atlassian/confluence"
   "log"
   "net/http"
   "os"
)

func main()  {

   var (
      host  = os.Getenv("HOST")
      mail  = os.Getenv("MAIL")
      token = os.Getenv("TOKEN")
   )

   instance, err := confluence.New(nil, host)
   if err != nil {
      log.Fatal(err)
   }

   instance.Auth.SetBasicAuth(mail, token)
   instance.Auth.SetUserAgent("curl/7.54.0")

   var (
      spaceKey = "DUMMY"
      depth = "all"
      expand = []string{"operations"}
      startAt = 0
      maxResults = 50
   )

   contents, response, err := instance.Space.Content(context.Background(), spaceKey, depth, expand, startAt, maxResults)
   if err != nil {

      if response != nil {
         if response.Code == http.StatusBadRequest {
            log.Println(response.Code)
         }
      }
      log.Println("Endpoint:", response.Endpoint)
      log.Fatal(err)
   }

   log.Println("Endpoint:", response.Endpoint)
   log.Println("Status Code:", response.Code)


   log.Println(contents.Links)
   log.Println(contents.Page)
}

Get content by type for space

GET /wiki/rest/api/space/{spaceKey}/content/{type}

Deprecated, use Confluence's v2 API.

Returns all content of a given type, in a space. The returned content is ordered by content ID in ascending order.

Create space

POST /wiki/rest/api/space

Creates a new space. Note, currently you cannot set space labels when creating a space.

Delete space

DELETE /wiki/rest/api/space/{spaceKey}

Deletes a space. Note, the space will be deleted in a long running task. Therefore, the space may not be deleted yet when this method has returned. Clients should poll the status link that is returned in the response until the task completes.

Get space

GET /wiki/rest/api/space/{spaceKey}

Deprecated, use Confluence's v2 API.

Returns a space. This includes information like the name, description, and permissions, but not the content in the space.

Get Spaces

GET /wiki/rest/api/space

Deprecated, use Confluence's v2 API.

Returns all spaces. The returned spaces are ordered alphabetically in ascending order by space key.

Update space

PUT /wiki/rest/api/space/{spaceKey}

Updates the name, description, or homepage of a space.

  • For security reasons, permissions cannot be updated via the API and must be changed via the user interface instead.

  • Currently, you cannot set space labels when updating a space.

Last updated

Was this helpful?