Created
September 25, 2021 05:56
-
-
Save ojmccall/c284ff822ace66ce100b62c59d5aa27c to your computer and use it in GitHub Desktop.
GCP - SFMC Find & Replace Section 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for JSON in Actarray: | |
change = 0 | |
if JSON["content"].find(oldName) >-1: | |
id = JSON["id"] | |
customerKey = JSON["customerKey"] | |
RawContent = JSON["content"] | |
content = RawContent.replace(oldName,newName) | |
data = { | |
"id": id, | |
"customerKey": customerKey, | |
"content": content | |
} | |
change += 1 | |
contentChanged +=1 | |
if change >0: #for each item where a change was made patch back into SFMC | |
url = "https://"+baseURL+".rest.marketingcloudapis.com/asset/v1/content/assets/"+str(id) | |
response = requests.patch(url, headers=head,data=data) | |
d = response.json() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment