Hi, I'm working with the PHP-SDK for the v2 API, and I can set a schedule for a campaign using "setSchedule" and everything goes through fine. What I want to do next is, if they go to update a campaign and it is already scheduled, set it back to "DRAFT" mode (deleteSchedule), make the changes, then reschedule it again. The problem is that when I call getSchedule, I do get a Schedule object in return, but both the id and the schedule_date come back as null, so I can't use it to send the id to deleteSchedule.
If I use the API tester at https://constantcontact.mashery.com/io-docs it brings back the actual values for the schedule just fine.
Any thoughts on what might be happening here? I don't think it's an invalid Campaign ID, because if I send a junk number, it throws an exception on the getSchedule call.
I don't actually have an answer yet on this, I just wanted to get you a reply to let you know that I'm looking into it! I should have more information a bit later this afternoon.
After some further testing on the latest version of the PHP SDK I was unable to reproduce the problem you've been seeing. Would it be possible to share a snippet of your code to show how you're attempting to get the schedule?
For reference, here is a sample of the code that I used:
$cc = new ConstantContact(APIKEY);
$schedules = $cc->campaignScheduleService->getSchedules(ACCESS_TOKEN, $campaignId); $schedule = $cc->campaignScheduleService->getSchedule(ACCESS_TOKEN, $campaignId, $schedules->id);
If you have any questions, please let me know!
After looking over your code there, I've found the problem I was having. I left off the S on getSchedules when I was trying to get the entire list of schedules, and thus was getting a null value when just passing the ConstantContact object and Campaign ID to getSchedule.
So basically I was calling $cc->campaignScheduleService->getSchedule(ACCESS_TOKEN, $cid);
when I should have been calling $cc->campaignScheduleService->getSchedules(ACCESS_TOKEN, $cid);
I should be okay now, thanks.
Glad to hear I could help! If you have any other trouble, please let me know!