Skip to content

Olli69/wc-api-java

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WooCommerce API Java Wrapper

Java wrapper for WooCommerce REST API. Currently the library supports only latest version of WooCommerce REST API (v1) with the OAuth 1.0a authentication over the HTTP protocol.

Setup

wc-api-java is available on maven central:

<dependency>
    <groupId>com.icoderman</groupId>
    <artifactId>wc-api-java</artifactId>
    <version>1.1</version>
</dependency>

Usage

    public static void main(String[] args) {
        // Setup client
        OAuthConfig config = new OAuthConfig("http://woocommerce.com", "consumerKey", "consumerSecret");
        WooCommerce wooCommerce = new WooCommerceAPI(config);

        // Prepare object for request
        Map<String, Object> productInfo = new HashMap<>();
        productInfo.put("name", "Premium Quality");
        productInfo.put("type", "simple");
        productInfo.put("regular_price", "21.99");
        productInfo.put("description", "Pellentesque habitant morbi tristique senectus et netus");

        // Make request and retrieve result
        Map product = wooCommerce.create(EndpointBaseType.PRODUCTS.getValue(), productInfo);

        System.out.println(product.get("id"));
    }

About

Java wrapper for WooCommerce REST API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%