Update a job.
Update the job information.
Function
updateJob()
Parameters
- username:
String
- Account login name.
- password:
String
- Account password.
- jobInfo:
Job
- Job object.
Return
int
:1
: success0
: failed
Exception
- Exception
Documentation
- Update a newly created job. use the function:
startJob()
. - Can update the job as long as it is in the
draft status
. - Cannot update the job once it has started.
- Job data that can be updated using the Job object is as follows, use at most:
- list ids,
- suppression ids,
- cluster names,
- rule set,
- message id,
- friendly from,
- from,
- subject,
- scheduled date,
- Friendly Reply-To,
- Reply-To,
- From format,
- search criteria ID,
- Skip the first,
Examples
public void updateJobSample() {
Puresend p = new Puresend();
PuresendPortType port = p.getPuresendHttpsSoap12Endpoint();
ObjectFactory factory = new ObjectFactory();
String username = "XXX";
String password = "XXX";
Job jobInfo = new Job();
// Use existing Job ID
jobInfo.setId(43196);
jobInfo.getClusterNames().add("clusterA");
jobInfo.setFrom(factory.createJobFrom("test@test.com"));
jobInfo.setFriendlyFrom(factory.createJobFriendlyFrom("Enter Value For From"));
jobInfo.getListIds().add(123);
jobInfo.getListIds().add(234);
jobInfo.getListIds().add(456);
// Use existing message ID
jobInfo.setMessageId(1234);
// Use ruleset id
jobInfo.setRulesetId(2345);
// Set Job Name
jobInfo.setName(factory.createJobName("Enter Non Existing Name"));
// Ignore or Set to null to schedule job immediately
Calendar cal = Calendar.getInstance();
cal.set(2018, 7, 20);
GregorianCalendar gcal = new GregorianCalendar();
gcal.setTime(cal.getTime());
jobInfo.setScheduledDate(factory.createJobScheduledDate(DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal)));
int result = port.updateJob(username, password, jobInfo);
if (result == 1) {
System.out.println("Job has been updated " + result);
}
}
<?php
include 'puresend.php';
$p = new Puresend();
$updateJobData = new updateJob();
$updateJobData->username = 'XXX';
$updateJobData->password = 'XXX';
$jobInfoData = new Job();
$jobInfoData->id = 43196;
$jobInfoData->from = 'newfrom@newdomain.com';
$updateJobData->jobInfo = $jobInfoData;
$response = $p->updateJob($updateJobData);
var_dump($response);
?>