Open
Description
This causes the date to be set to the default value of the last 30 days (see Campaign Monitor's API Documentation here), instead of the date that is passed in. Where it says (MultivaluedMap)null
, it should really say queryString
instead, like the methods for getting the number of unsubscribes, bounces, opens, and clicks do for the Journey API.
private PagedResult<JourneyEmailRecipient> recipients(String fromDate, Integer page, Integer pageSize, String orderDirection) throws CreateSendException {
MultivaluedMap<String, String> queryString = new MultivaluedMapImpl();
queryString.add("date", fromDate);
return this.jerseyClient.getPagedResult(page, pageSize, (String)null, orderDirection, (MultivaluedMap)null, new String[]{"journeys", "email", this.journeyEmailID, "recipients.json"});
}
For our project, I created a JourneyEmail
Java class that extends the CreateSendBase
Java class so that I could override the recipients
method and replace the null
value with the date that I passed in.
import com.createsend.CreateSendBase;
import com.createsend.models.PagedResult;
import com.createsend.models.journeys.JourneyEmailRecipient;
import com.createsend.util.AuthenticationDetails;
import com.createsend.util.JerseyClientImpl;
import com.createsend.util.exceptions.CreateSendException;
import com.createsend.util.jersey.JsonProvider;
import com.sun.jersey.core.util.MultivaluedMapImpl;
import javax.ws.rs.core.MultivaluedMap;
import java.util.Date;
public class JourneyEmail extends CreateSendBase {
private final String journeyEmailID;
public JourneyEmail(AuthenticationDetails auth, String journeyEmailID) {
this.journeyEmailID = journeyEmailID;
this.jerseyClient = new JerseyClientImpl(auth);
}
public PagedResult<JourneyEmailRecipient> recipients(Date fromDate, Integer page, Integer pageSize, String orderDirection) throws CreateSendException {
String fromDateStr = JsonProvider.ApiDateFormat.format(fromDate);
MultivaluedMap<String, String> queryString = new MultivaluedMapImpl();
queryString.add("date", fromDateStr);
return this.jerseyClient.getPagedResult(page, pageSize, null, orderDirection, queryString, new String[]{"journeys", "email", this.journeyEmailID, "recipients.json"});
}
}
Metadata
Metadata
Assignees
Labels
No labels