URL para requisição do token de autorização para uso da API:
https://SUBDOMAIN.auth.marketingcloudapis.com/v2/token
HEADERS = {'Content-type': 'application/json'}
PAYLOAD = {
"grant_type": "client_credentials",
"client_id": CLIENT_ID,
"client_secret": CLIENT_SECRET,
"scope": "data_extensions_write"
}
AUTHENTICATION_RESPONSE = requests.post(
url=URL, data=json.dumps(PAYLOAD), headers=HEADERS
).json()
URL = f"https://SUBDOMAIN.rest.marketingcloudapis.com/data/v1/async/dataextensions/key:EXTERNALKEY/rows"
headers = {'Content-type': 'application/json',
'authorization': f'Bearer {access_token}'}
insert_request = requests.post(
url=URL,
data=json.dumps(data),
headers=HEADERS
)
data = {
"items": [{
"FIELD_STRING" : "NAME",
"FIELD_BOOLEAN" : "false"
}]
}