I have a nice integration setup for salesforce using the simple-salesforce Python package. I can easily insert, extract and describe objects across Salesforce.
I would like something similar in order to interact with the data in Marketing Cloud. What is the best solution to be able to query data in data views or data extensions in Marketing Cloud.
Do I need to setup a Marketing Cloud API integration? If so what is the best practice for setting this up and are there any examples of connecting to it? Is this best through the Fuel SDK library?
When trying to authenticate with the example from this site I got a 401 response. I have an installed package called Marketing Cloud API and I added a component that is of type Web App, with read and write to data extensions. I used the client id and secret key associated with the api integration. The json error was {'message': 'Unauthorized', 'errorcode': 1, 'documentation': ''}
.
Any thoughts on the error or best practice for this kind of integration would be great, thanks.
def auth(clientId: str,
clientSecret: str
) -> requests.Response:
end_point = "https://auth.exacttargetapis.com/v1" + "/requestToken"
headers = {'Content-type': 'application/json'}
payload = {
"clientId": clientId,
"clientSecret": clientSecret,
"accessType": "offline"
}
req = requests.post(
end_point,
headers=headers,
data=json.dumps(payload)
)
return req
auth(clientId, clientSecret)