Working with Confluence REST APIs: Simplified 101

on API, Confluence, REST API • October 26th, 2021 • Write for Hevo

The demand for APIs is booming in parallel with the increasing adoption of digital technologies. As companies strive to enhance the pace of their operations, streamline procedures, and provide a better overall customer experience across all industry verticals, APIs have become a focal point for the development of software solutions to achieve those goals. APIs allow various internet services to communicate with one another.

With APIs, users can retrieve data from another program without having to deal with the user interface of the source application. APIs, for example, are used to provide navigation in mobile apps, authenticate consumer bank account information, and connect a patient’s data with third-party billing. Today, even team collaboration software like Confluence is offering API options to help companies create, share and collaborate on any content needed for work. In the following sections, we shall learn how Confluence REST APIs work.

Table of Contents

Prerequisites

  • Understand the need for integration.

Introduction to Confluence

Confluence REST API: Confluence Logo
Image Source

Confluence is a team collaboration application by Atlassian that allows team members to communicate as a group by discussing tasks, recording decisions, commenting on documents, and more. When new team members join, Confluence provides them with context and history regarding the projects at hand and the team itself.

Confluence features a simple user interface and an editor that resembles standard desktop publishing (DTP) software or word processing tools like Microsoft Word. It offers page templates to assist users in creating content effortlessly. However, if developers want to move beyond existing templates, they can create templates from scratch.

Like Confluence, Atlassian offers JIRA, an agile management solution that is used for Project Management, Bug Tracking, Issue Tracking, and Workflow. Users can integrate Confluence and JIRA to get the most out of each other. Furthermore, Confluence comes with excellent connectors, allowing it to effortlessly integrate with the Atlassian ecosystem and make use of the Atlassian Marketplace’s hundreds of apps. It offers REST APIs that can help with either developing an app or integrating Confluence with another application.

Confluence software is now offered in two formats:

  • Subscription-based: This is hosted in the cloud and available on a subscription basis. While there is a free version, to avail more functionalities fee will be charged for purchasing and renewing a subscription plan. It is ideal for businesses that do not want to get into the hassle of managing their implementation.
  • Self-hosted: This is hosted on internal servers or in Confluence Data Centers. It is suitable for businesses who wish to have full control over their Atlassian implementation.

Key Features of Confluence

Confluence enabled document sharing and collaborative work for businesses restricted by regulatory constraints and in need of organized alternatives for various teams. Here are a few of this tool’s best features:

  • Wide Range of Pages: Confluence has various best practices templates for creating pre-formatted pages e.g. product planning. You can also use pages to communicate updates and information to your staff and consumers by marketing blog entries and how-to articles. You may also make these pages more interesting by including videos, pictures, and other media.
  • Site Management: Confluence allows you to rename pages with updated links. Users can not only import spaces and pages from plain text files but also export the data to PDF and HTML. You may also view a report of ‘orphaned’ pages that are not linked to any parent page and eventually link or remove them based on your needs.
  • Macros: The Confluence tool has various macros that allow users to add dynamic content and additional functionality to a page. With over 35 macros and the additional feature of installing plugins from Atlassian’s Plugin Exchange, Confluence stands out. Some of the macros are as follows: Chart Macro, Gallery Macro, Tasklist Macro, JIRA Issues Macro, Office Excel Macro, Office PowerPoint Macro, Office Word Macro, and many more. 
  • Mobile App Availability: You can work, create and edit pages from anywhere using Confluence’s mobile apps too, i.e., Mobile App for Confluence Cloud and Mobile App for Confluence Server.
  • Controlled Restrictions: You may limit who can see and modify certain Pages in Confluence. In Confluence, you may personalize all levels of collaboration by creating a Page only for yourself or making it public. Confluence allows you to tag other users and share additional Pages with specific individuals.

Simplify REST API ETL with Hevo’s No-code Data Pipeline

A fully managed No-code Data Pipeline platform like Hevo Data helps you integrate and load data from  100+ sources (including 40 Free Data Sources like REST APIs) to a destination of your choice in real-time in an effortless manner. 

Get Started with Hevo for Free

Hevo with its minimal learning curve can be set up in just a few minutes allowing the users to load data without having to compromise performance. Its strong integration with umpteenth sources allows users to bring in data of different kinds in a smooth fashion without having to code a single line. Hevo’s REST API Connector also allows loading data from non-native sources.

Check out some of the cool features of Hevo:

  • Completely Automated: The Hevo platform can be set up in just a few minutes and requires minimal maintenance.
  • Transformations: Hevo provides preload transformations through Python code. It also allows you to run transformation code for each event in the Data Pipelines you set up. You need to edit the event object’s properties received in the transform method as a parameter to carry out the transformation. Hevo also offers drag and drop transformations like Date and Control Functions, JSON, and Event Manipulation to name a few. These can be configured and tested before putting them to use.
  • Real-Time Data Transfer: Hevo provides real-time data migration from data sources like Google Analytics and Shopify, so you can have analysis-ready data always.
  • 100% Complete & Accurate Data Transfer: Hevo’s robust infrastructure ensures reliable data transfer with zero data loss.
  • Scalable Infrastructure: Hevo has in-built integrations for 100+ sources that can help you scale your data infrastructure as required.
  • 24/7 Live Support: The Hevo team is available round the clock to extend exceptional support to you through chat, email, and support calls.
  • Schema Management: Hevo takes away the tedious task of schema management & automatically detects the schema of incoming data and maps it to the destination schema.
  • Live Monitoring: Hevo allows you to monitor the data flow so you can check where your data is at a particular point in time.
Sign up here for a 14-Day Free Trial!

Introduction to APIs

The application programming interface (API) is a collection of rules and methods that govern how one application or component communicates with other components or applications. APIs can deliver data in widely used formats like JSON and XML to simplify integration among varied applications. In general, APIs can be private (for internal usage only), partnered (for particular purposes only), or public (third parties).

Understanding REST Architecture

Confluence REST API: REST Architecture
Image Source

REST, which stands for representational state transfer, is a software architectural style that establishes a framework for client-server communication via the internet. REST is a set of software design restrictions that promotes system performance, scalability, simplicity, and dependability. In simpler words, REST architecture determines how APIs look like.

A REST (or RESTful) web application offers information about its resources without the need for massive processing capabilities. It also allows the client to perform operations on those resources, such as developing new resources or modifying available resources. 

Any data in the web service that can be accessed and changed with HTTP queries to the REST API is referred to as a resource. The HTTP method instructs the API on how to handle the resource. Using commands like GET (receiving data in a convenient format), POST (creating new data), PUT (updating data), DELETE (deleting data), PATCH (partially update), and others, an HTTP request is used to access web services and manipulate the data. Here, each URL is considered as a request, and the data returned to the user is referred to as a response.

Introduction to REST API

A REST API is a set of protocols that specify how various apps communicate via HTTP. The information flow is quick and efficient in this technique. Because data formats aren’t pre-defined, it may be used for a wider range of purposes and is simpler to create. REST APIs have, therefore, become the standard protocol for web-based APIs and are a popular choice among web developers. They allow users to search for items and have the results returned by the service from which they made the request.

To make APIs RESTful, programmers must adhere to a set of guidelines while creating them. The REST set of constraints will make the APIs easier to use and find, making it easy for a developer who is just getting started with these APIs to understand how to leverage them. These constraints are Uniform interface, Client-server separation, Stateless, Layered system, Cacheable, and Code-on-demand.

After receiving and processing an HTTP request, a REST API will provide an HTTP response. The HTTP status code is included in this response. This code contains information about the request’s outcomes. The status code may be checked by an application issuing API calls, and actions can be taken based on the result. These might include resolving errors or sending a success message to a user.

It is important to note that HTTP status codes appear on all requests made by users. They come in a variety of sizes and are categorized into five types. The first digit denotes which group a code belongs to:

  • 1xx – informational
  • 2xx – success
  • 3xx – redirection
  • 4xx – client error
  • 5xx – server error

Understanding Confluence REST APIs

Confluence REST APIs can be used for a variety of tasks, including creating pages, deleting pages, adding comments, and creating spaces. However, for REST APIs, Confluence only supports two authentication methods:

  • Basic Authentication
  • Using Confluence as OAuth 1.0 Provider

The Confluence REST API Authentication plugin allows users to authenticate Confluence REST APIs using any third-party OAuth 2.0 provider/OpenID connect.

Features

  • CRUD: The Confluence REST APIs in Confluence allow you to access resources (data entities) via URI paths. Your application will perform an HTTP request and interpret the result to use a Confluence REST API. The response format is JSON by default for a Confluence REST API. The normal HTTP methods include: GET, PUT, POST, and DELETE. Because the Confluence REST API is built on open standards, you can use it with any web development language.
  • Pagination: The Confluence REST API employs pagination, which is a technique that delivers a response containing many objects but can only return a certain amount at a time. This keeps response sizes small and saves server resources.
  • Expansion: To restrict the number of requests to the Confluence REST API and the size of the responses, the Confluence REST API employs resource expansion. Some elements of a resource are not returned until they are expressly requested. This streamlines replies while reducing network traffic for the Confluence REST API.

Confluence Server REST API

The Confluence Server REST API is for administrators who wish to script Confluence Server and Data Center interactions, as well as developers who want to interface with or build on top of the Confluence platform.

Examples:

  • Browsing Content
curl -u admin:admin http://localhost:8080/confluence/rest/api/content/ | python -mjson.tool
  • Read Content and Expand the Body:
curl -u admin:admin http://localhost:8080/confluence/rest/api/content/3965072?expand=body.storage |
python -mjson.tool

Examples:

  • Create a New Page as a Child of Another Page:
Confluence REST API: Create a New Page
Image Source
  • Update a Page:
Confluence REST API: Update Page
Image Source

Confluence Cloud REST API

This Confluence REST API is the primary way to retrieve and edit data in Confluence Cloud, whether you’re building an app or another integration.

Examples:

  • Browsing Content:
curl -u admin@example.com:api_token https://your-domain.atlassian.net/wiki/rest/api/content/ | python -mjson.tool
  • Read Content and Expand the Body:
curl -u admin@example.com:api_token https://your-domain.atlassian.net/wiki/rest/api/content/3965072?expand=body.storage | python -mjson.tool

Conclusion

This article introduces you to the basics of REST API and the key constraints that govern its architecture. It also offers a brief overview of Confluence REST APIs.

Extracting complex data from a diverse set of free data sources like REST APIs can be a challenging task and this is where Hevo saves the day!

Visit our Website to Explore Hevo

Hevo Data offers a faster way to move data from 100+ data sources such as SaaS applications, Databases, Files, etc. Hevo’s native REST API connector can help connect with a variety of non-native/custom sources into your Data Warehouse to be visualized in a BI tool. Hevo is fully automated and hence does not require you to code.

Want to take Hevo for a spin? Sign Up for a 14-day free trial and experience the feature-rich Hevo suite first hand. You can also have a look at the unbeatable pricing that will help you choose the right plan for your business needs.

No-code Data Pipeline for REST APIs