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.
- Log into WCA.
- Go to Menu Settings -> Organization Settings.
- Click on Application Account Access.
- Click on Add Application button and follow instructions.
- Log into WCA.
- Go to Menu Settings -> Organization Settings.
- Click on Application Account Access.
- Click on Add Account Access button and follow instructions. Choose Application you have added when requested ClientId and ClientSecret.
Library does NOT support password authentication mechanism due to security concerns.
Every API has 2 corresponding classes:
- Options - input parameters for API.
- Response - API output parameters.
In order to call API please follow these instructions:
- Initiate corresponding Options object.
- Path Options object to Engage method which has the same name as API.
- Read Response produced by method from step #2.
- 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)
- Autowire Engage service
@Autowired
private Engage engage;
- Use Engage service
ExportListOptions options = new ExportListOptions(66912L);
ResponseContainer<ExportListResponse> response = engage.exportList(options);
System.out.println(response.getResposne());
- Import SpringConfig class
import org.springframework.context.annotation.Import;
import com.github.ka4ok85.wca.config.SpringConfig;
@Import(SpringConfig.class)
- Init Engage service instance
Engage engage = new Engage(1, "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
- Use Engage service
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.
- Ability to download Export File. Supported by following APIs:
- ExportList
- ExportMailingTemplate
- ExportTable
- RawRecipientDataExport
- WebTrackingDataExport
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);