Scheduling a program using REST api

Nilesh_Darji1
Level 1

Scheduling a program using REST api

Hi,

I am trying to schedule a program using REST api after cloning it using an API call. The update operation is successful but I don't see the start date populated on the front-end. Can programs be scheduled and sent out using REST API? 

Here is the end point I am using:

https://456-QRK-012.mktorest.com/rest/asset/v1/program/2378.json

Here is the payload:

costs=[{"startDate":"2019-05-14T23:45:00.000Z","cost":2000}]&costsDestructiveUpdate=true

Here is the response I am getting:

{
"success": true,
"errors": [],
"requestId": "4d12#16ab8838dd6",
"warnings": [],
"result": [
{
"id": 2378,
"name": "HP_05.14.2019.6",
"description": "",
"createdAt": "2019-05-14T22:34:52Z+0000",
"updatedAt": "2019-05-14T22:34:52Z+0000",
"url": "https://app-ab05.marketo.com/#EBP2378A1",
"type": "Email",
"channel": "Email Send",
"folder": {
"type": "Folder",
"value": 3283,
"folderName": "100.HomeUnion"
},
"status": "unlocked",
"workspace": "Default",
"tags": [],
"costs": [
{
"startDate": "2019-05-14T05:00:00Z+0000",
"cost": 2000,
"note": ""
}
]
}
]
}
3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Scheduling a program using REST api

Set the endDate. Approve the program. It's in the docs.

Nilesh_Darji1
Level 1

Re: Scheduling a program using REST api

Tried setting endDate using following payload but it doesn't seem to be updating endDate. There is no endDate in the response and tried approving after that but I am getting "709 - Unable to approve program"

costs=[{"startDate":"2019-05-15","endDate":"2019-05-15","cost":2000}]&costsDestructiveUpdate=true
Jignesh_Bhate
Level 2

Re: Scheduling a program using REST api

It seems you are passing endDate for the costs, which is incorrect, as Costs just have startDate, remember the UI in which we set the program costs. The payload for Program REST API has to be in this format below. Please refer https://developers.marketo.com/rest-api/endpoint-reference/asset-endpoint-reference/#!/Programs/upda...

{
"costs": [
{
"cost": 0,
"note": "string",
"startDate": "2019-05-15T03:30:33.989Z"
}
],
"costsDestructiveUpdate": true,
"description": "string",
"endDate": "string",
"name": "string",
"startDate": "string",
"tags": [
{
"tagType": "string",
"tagValue": "string"
}
]
}

Hope this is helpful!