An open API service indexing awesome lists of open source software.

https://github.com/the-oglow/ya-corapi

Yet Another Confluence Rest API
https://github.com/the-oglow/ya-corapi

confluence confluence-data-center data-center datacenter rest-api restapi

Last synced: about 1 month ago
JSON representation

Yet Another Confluence Rest API

Awesome Lists containing this project

README

          

# Yet Another Confluence REST API

![Latest Version](https://img.shields.io/badge/release-latest-blue?logo=github&style=plastic "Latest Version")
![Software License](https://img.shields.io/github/license/The-oGlow/ya-corapi?logo=github&style=plastic "Software License")
![GitHub Release](https://img.shields.io/github/v/release/The-oGlow/ya-corapi?logo=github&style=plastic "GitHub Release")

![Language Count](https://img.shields.io/github/languages/count/The-oGlow/ya-corapi?logo=github&style=plastic "Language Count")
![Language Top](https://img.shields.io/github/languages/top/The-oGlow/ya-corapi?logo=github&style=plastic "Language Top")
![Commit Status Master](https://img.shields.io/github/checks-status/The-oGlow/ya-corapi/master?logo=github&label=checks%20master&style=plastic "Commit Status Master")
![Commit Status Develop](https://img.shields.io/github/checks-status/The-oGlow/ya-corapi/develop?logo=github&label=checks%20develop&style=plastic "Commit Status Develop")

(c) 2024 Oliver Glowa

# Description

Managing the maintenance of a confluence instance via REST API.

# Requirements

- Commandline
- Linux / Unix Shell or
- Windows Shell
- [PHP](https://www.php.net)
- [Composer](https://getcomposer.org/) (optional)

# Configuration

## Unix / Linux

- Clone this repository to your local drive
- Create the folder
- `mkdir ${HOME}/.ya-corapi`
- Copy the file to the created folder
- `cp ./cfg/myauth.php.dist ${HOME}/.ya-corapi/myauth.php`
- Edit the file `${HOME}/.ya-corapi/myauth.php`
- Replace `#confluence-url_for_production#` with your Confluence URL for the production environment
- Replace `#confluence-url_for_testing#` with your Confluence URL for the testing environment

## Windows

- Clone this repository to your local drive
- Create the folder
- `mkdir %USERPROFILE%\.ya-corapi`
- Copy the file to the created folder
- `copy .\cfg\myauth.php.dist %USERPROFILE%\.ya-corapi\myauth.php`
- Edit the file `%USERPROFILE%\.ya-corapi\myauth.php`
- Replace `#confluence-url_for_production#` with your Confluence URL for the production environment
- Replace `#confluence-url_for_testing#` with your Confluence URL for the testing environment

# How to use it

The functions are separated in subfolders
- count -> Count specific pages / elements
- search -> Search for specific pages / elements

Starting a function is easy from the shell (commandline)

php -f .//.php

E.g.

php -f ./search/searchpage.php

The results are printed to the console or into a file in the target folder

./target///.

The output can be
- Text
- CSV
- JSON

# Roadmap

## r0.1 (first release)
- Move code from PoC to OO
- Create simple write actions
- Create examples and describe their purpose
- Describe the installation and usage of this library

## r0.2
- Decouple [`IConnectionProvider`](src/yacorapi/IConnectionProvider.php) to support different provider
- Externalize functions for the [Projectdoc Toolbox](https://www.smartics.eu/spaces/PDAC1/projectdoc-Toolbox_3671724.html) into its own library

## r0.3
- Decouple the REST-API definitions to support different confluence versions (e.g. Cloud) or atlassian tools (e.g. Jira)
- Create write actions by batch

## r0.4
- Code cleanup release
- Code coverage release
- Setup github actions

## Near or Far Future
- Create an alternative provider
- Implement a Cloud fortifed REST-API definition

# Development

Some infos, in case you want to fork and extend this library,

## Structure

Relevant files and folders


|--cfg
| |-mayauth.php.dist
| |-myspaces.php.dist
|
|--example
| |-*

|--src
| |-- Monolog
| |-- PHPUnit
| |-- yacorapi
|
|--target
| |- *
|
|--tests
| |--yacorapi
|
|--vendor
| |- *
|
|-composer.json
|-composer.lock
|-php-cs-fixer.php.dist
|-phpstan.neon.dist
|-phpunit.xml.dist
|-README.md

## UNIT Tests

Starting the unit tests (PHP Unit)

./vendor/bin/phpunit


## Quality Analysis

| | Branch 'master' | Branch 'develop'
| :--- | :---: | :---:
| **Build**
| Github.com | - | -
| **Quality Information**
| Sonarcloud.io | - | [![Sonarcloud](https://sonarcloud.io/api/project_badges/quality_gate?project=The-oGlow_ya-corapi)](https://sonarcloud.io/dashboard?id=The-oGlow_ya-corapi)
| **Test Information**
| Sonarcloud.io | [![Sonarcloud](https://img.shields.io/sonar/tests/The-oGlow_ya-corapi/master?server=https%3A%2F%2Fsonarcloud.io&compact_message&style=plastic&logo=sonar)](https://sonarcloud.io/dashboard?id=The-oGlow_ya-corapi)
[![Sonarcloud](https://img.shields.io/sonar/test_success_density/The-oGlow_ya-corapi/master?server=https%3A%2F%2Fsonarcloud.io&compact_message&style=plastic&logo=sonar)](https://sonarcloud.io/dashboard?id=The-oGlow_ya-corapi)
[![Sonarcloud](https://img.shields.io/sonar/coverage/The-oGlow_ya-corapi/master?server=https%3A%2F%2Fsonarcloud.io&compact_message&style=plastic&logo=sonar)](https://sonarcloud.io/dashboard?id=The-oGlow_ya-corapi)
[![Sonarcloud](https://img.shields.io/sonar/violations/The-oGlow_ya-corapi/master?server=https%3A%2F%2Fsonarcloud.io&compact_message&style=plastic&logo=sonar)](https://sonarcloud.io/dashboard?id=The-oGlow_ya-corapi)
| [![Sonarcloud](https://img.shields.io/sonar/tests/The-oGlow_ya-corapi/develop?server=https%3A%2F%2Fsonarcloud.io&compact_message&style=plastic&logo=sonar)](https://sonarcloud.io/dashboard?id=The-oGlow_ya-corapi)
[![Sonarcloud](https://img.shields.io/sonar/test_success_density/The-oGlow_ya-corapi/develop?server=https%3A%2F%2Fsonarcloud.io&compact_message&style=plastic&logo=sonar)](https://sonarcloud.io/dashboard?id=The-oGlow_ya-corapi)
[![Sonarcloud](https://img.shields.io/sonar/coverage/The-oGlow_ya-corapi/develop?server=https%3A%2F%2Fsonarcloud.io&compact_message&style=plastic&logo=sonar)](https://sonarcloud.io/dashboard?id=The-oGlow_ya-corapi)
[![Sonarcloud](https://img.shields.io/sonar/violations/The-oGlow_ya-corapi/develop?server=https%3A%2F%2Fsonarcloud.io&compact_message&style=plastic&logo=sonar)](https://sonarcloud.io/dashboard?id=The-oGlow_ya-corapi)

[![SonarQube Cloud](https://sonarcloud.io/images/project_badges/sonarcloud-light.svg)](https://sonarcloud.io/summary/new_code?id=The-oGlow_ya-corapi)

# Notice

- Examples are working with privat access token (PAT) only!
- Tested & Working with the Confluence Data Center Edition (DCE)
- By default the requests are sent to the URL of `#confluence-url_for_testing#`
- Edit the file `${HOME}/.ya-corapi/myauth.php` (Windows: `%USERPROFILE%\.ya-corapi\myauth.php`)
- Set `CONST USE_PROD = false` to `CONST USE_PROD = true`