SOLVED

API - change program metadata returning the same details?

Go to solution
Phillip_Wild
Level 10

API - change program metadata returning the same details?

Hi everyone

 

I'm using this endpoint to try and update the name of a Marketo Email program. https://developers.marketo.com/rest-api/endpoint-reference/asset-endpoint-reference/#!/Programs/upda...

 

Here's my Python code:

 

updateProgramRequest = {'name': 'GA_190123 VIP Wellness Sale - German'}
parameters = {'access_token': access_token, 'updateProgramRequest': updateProgramRequest}
data = requests.post(
base_endpoint + "program/5525.json",
params=parameters
).json()

 

I get a 200 response, so it's saying it worked - but all the parameters - including "name", which I am trying to update - look exactly the same. I confirmed in Marketo that nothing has changed. Why?

1 ACCEPTED SOLUTION

Accepted Solutions
Phillip_Wild
Level 10

Re: API - change program metadata returning the same details?

Ah, thank you! I was passing the details as parameters instead of inside the body of the request. I changed that and now it's working.

 

However, I do find it weird that I get a 200 success response when nothing happened. If you post a change, and no change is posted, surely that shouldn't come back with "success"?

View solution in original post

2 REPLIES 2
Harish_Gupta6
Level 8

Re: API - change program metadata returning the same details?

I just tried the same in postman using the below endpoint and parameter and it works fine:

 

End Point

 
Note* 3717 is the program id of Email program which I am renaming using API
 

Body

description=This is an updated description&name=New Name&costs=
[{"startDate":"2016-01-01","cost":200,"note":"Google Adwords"}]
 
Header parameter: 
Access token: xxx
Content-type:application/x-www-form-urlencoded

 

Response:

{
    "success"true,
    "errors": [],
    "requestId""d56a#17014363cf3",
    "warnings": [],
    "result": [
        {
            "id"3717,
            "name""New Name",
            "description""This is an updated description",
            "createdAt""2019-06-13T12:59:50Z+0000",
            "updatedAt""2020-02-05T07:17:45Z+0000",
            "url""https://app-xxx.marketo.com/#xxxxx",
            "type""Email",
            "channel""Email Send",
            "folder": {
                "type""Folder",
                "value"5516,
                "folderName""Pracitice Training"
            },
            "status""unlocked",
            "workspace""Training",
            "tags": [],
            "costs": [
                {
                    "startDate""2016-01-01T06:00:00Z+0000",
                    "cost"200,
                    "note""Google Adwords"
                }
            ]
        }
    ]
}

 

Note* My API user has both read/write access for all operations on the Program.

Harish Gupta
Phillip_Wild
Level 10

Re: API - change program metadata returning the same details?

Ah, thank you! I was passing the details as parameters instead of inside the body of the request. I changed that and now it's working.

 

However, I do find it weird that I get a 200 success response when nothing happened. If you post a change, and no change is posted, surely that shouldn't come back with "success"?