Skip to content

evisentin/wp-rest-client

Repository files navigation

WordPress REST API Client for Java

Maven Central Website Javadoc License Build Coverage Java Java

wp-rest-client is an open-source WordPress REST API client for Java. It provides a modern, type-safe Java API for interacting with the WordPress REST API, including posts, pages, media, categories, tags, users and custom endpoints.

Features

  • Type-safe Java API
  • Automatic WordPress REST API discovery
  • Apache HttpClient implementation
  • OkHttp implementation
  • Integration-tested against multiple WordPress versions
  • Modular architecture

Installation

Apache HttpClient

<dependency>
    <groupId>io.github.evisentin</groupId>
    <artifactId>wp-rest-client-apache</artifactId>
    <version>::latest::</version>
</dependency>

OkHttp

<dependency>
    <groupId>io.github.evisentin</groupId>
    <artifactId>wp-rest-client-okhttp</artifactId>
    <version>::latest::</version>
</dependency>

Quick Example

final WpRestClient client =
        ApacheWpRestClientBuilder.basicAuthentication(
                "https://my-wordpress-site.com",
                "admin",
                "password"
        ).build();

final List<WpPost> posts =
        client.posts()
                .list(WpPaginationQuery.of(1, 10), WpPostQuery.builder().build())
                .getItems();

Documentation

Full documentation is available at:

https://evisentin.github.io/wp-rest-client/

Topics covered include:

  • Installation
  • Authentication
  • Getting Started
  • Supported APIs
  • Architecture
  • Contributing
  • Developer Setup

Compatibility

WP REST Client is continuously tested against WordPress versions 6.3 through 7.0.

License

Licensed under the Apache License 2.0.

Packages

 
 
 

Contributors