compile group: 'com.github.ka4ok85', name: 'watson-campaign-automation-spring', version: '0.0.3'
<dependency>
<groupId>com.github.ka4ok85</groupId>
<artifactId>watson-campaign-automation-spring</artifactId>
<version>0.0.3</version>
</dependency>
Use oAuth authentication mechanism. Log into WCA and request your ClientId, ClientSecret and RefreshToken. All three values are required for accessing WCA API.
Library does NOT support password authentication mechanism due to security concerns.
Every API has 2 corresponding classes:
In order to call API please follow these instructions:
Add required values to application.properties
podNumber=1
clientId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
clientSecret=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
refreshToken=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Import SpringConfig class
import org.springframework.context.annotation.Import;
import com.github.ka4ok85.wca.config.SpringConfig;
@Import(SpringConfig.class)
3. Autowire *Engage* service
```java
@Autowired
private Engage engage;
ExportListOptions options = new ExportListOptions(66912L);
ResponseContainer<ExportListResponse> response = engage.exportList(options);
System.out.println(response.getResposne());
import org.springframework.context.annotation.Import;
import com.github.ka4ok85.wca.config.SpringConfig;
@Import(SpringConfig.class)
2. Init *Engage* service instance
```java
Engage engage = new Engage(1, "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
ExportListOptions options = new ExportListOptions(66912L);
ResponseContainer<ExportListResponse> response = engage.exportList(options);
System.out.println(response.getResposne());
Besides easy access to WCA XML API Library provides additional convenience functionality. Please find more details below.
Following code snippet will download ExportList API result file to your local machine:
ExportListOptions options = new ExportListOptions(1L);
options.setLocalAbsoluteFilePath("c:\\data\\export_list.csv");
ResponseContainer<ExportListResponse> response = engage.exportList(options);