Skip to content

Commit cc47123

Browse files
authored
Update README.md
1 parent 3e517aa commit cc47123

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,78 @@
11
# The WooCommerce REST API Client for Java
22
The WooCommerce REST API Client for Java provides easy access to the features of the e-commerce platform's API.
3+
The client supports the WooCommerce REST API in th latest v3 version.
4+
5+
---
6+
7+
> ⚠️ **Note: This is a development version!**
8+
>
9+
> The API client is under development and will be gradually expanded to cover the key API functionalities of the commerce engine.
10+
11+
---
12+
13+
14+
## Setup
15+
1. Download this project and build it to create a new artifact in the local Maven repository - use simple command:
16+
```
17+
mvn clean install
18+
```
19+
2. After a successful build, you can use the following artifact as a dependency in your Java project:
20+
wc-api-java is available on maven central:
21+
```xml
22+
<dependency>
23+
<groupId>wtx.woocommerce</groupId>
24+
<artifactId>woocommerce-api-client</artifactId>
25+
<version>0.1.0</version>
26+
</dependency>
27+
```
28+
29+
## Usage
30+
Below is an example usage of the WooCommerceApiClient:
31+
32+
```java
33+
package wtx.woocommerce;
34+
35+
import java.util.List;
36+
37+
import wtx.woocommerce.api.client.CustomersApi;
38+
import wtx.woocommerce.api.client.invoker.ApiException;
39+
import wtx.woocommerce.api.client.model.Customer;
40+
41+
public class WooCommerceApiClientUsageDemo {
42+
43+
public static void main(String[] args) {
44+
45+
System.out.println(">>> Start running the WooCommerceApiClientUsageDemo...");
46+
47+
// Use WooCommerceApiClient(true) if you need to log API communication messages.
48+
WooCommerceApiClient apiClient = new WooCommerceApiClient();
49+
50+
// TODO: Set your host and credentials!
51+
apiClient.setBasePath("https://your-woocommerce-shop.com/wp-json/wc/v3");
52+
apiClient.setUsername("TODO_SET_API_USERNAME");
53+
apiClient.setPassword("TODO_SET_API_PASSWORD");
54+
55+
CustomersApi customersApi = new CustomersApi(apiClient);
56+
57+
try {
58+
59+
List<Customer> customers = customersApi.listAllCustomers(null, null, null, null, null, null, null, null, null, null, null, null, null);
60+
61+
// Example list of customer emails:
62+
for (Customer customer : customers) {
63+
System.out.println("Customer: " + customer.getEmail());
64+
}
65+
66+
} catch (ApiException e) {
67+
System.err.println("Error occurred during API call: " + e);
68+
}
69+
70+
System.out.println("<<< The WooCommerceApiClientUsageDemo has been finished.");
71+
72+
}
73+
74+
}
75+
```
76+
## Let's stay in touch!
77+
The client will be continuously developed to incorporate new features and improvements.
78+
See you soon :)

0 commit comments

Comments
 (0)