Per the documentation, I've created an "installed package" in the admin panel of SFMC, which provides me a clientId
and clientSecret
. I'm using the Python requests
library to make the call from my command line. This is just to get an accessToken
, so the code is pretty straightforward:
import requests
url = 'https://auth.exacttargetapis.com/v1/requestToken'
headers = {'Content-Type': 'application/json'}
clientId = '123'
clientSecret = 'abc'
response = requests.request('POST', url,
headers=headers,
auth=(clientId, clientSecret),
verify=False)
print(response.text)
The verify
flag is set to False
for now because of unresolved issues with the Python package certifi
, but this is a separate issue and shouldn't affect the request.
I don't know exactly what the issue is, but I always receive this error message:
{"message":"clientId is required","errorcode":10002,"documentation":""}
I'm supplying the clientId in the appropriate (Python) syntax, and it's such a simple request that I can't see why it's failing. Any help is much appreciated.
SFMC API documentation: https://developer.salesforce.com/docs/atlas.en-us.mc-getting-started.meta/mc-getting-started/mc-dev-setup.htm
Requests (Python HTTP library): http://docs.python-requests.org/en/master/