Getting Marketo data in Python — Marketo rest API and Python API
There are two ways I have used to get Marketo data in Python. First is to use Marketo rest API directly. Second is to use the marketo Python API marketorestpython
. I really like the marketorestpython
library and I highly recommend everyone to use this library. But in this article, I am going to talk about both approach.
Marketo rest API
First, we need to get client_id
, client_secret
, munchkin_id
/instance URL information. Client Id and Client Secret can be set up via LaunchPoint and they can be found under Admin > LaunchPoint > View Details . And Munchkin Account ID can be found under Admin > Integration > Munchkin menu. munchkin_id
is also part of the instance URL, which can be found under Admin > Integration > Web Services > REST API > Identity.
munchkin_id = ""
client_id = ""
client_secret= ""
args = {'grant_type': 'client_credentials',
'client_id': client_id,
'client_secret': client_secret}
host = f'https://{munchkin_id}.mktorest.com'
Second, we need to get access token
and next page token
. Since we have all the credentials ready. We can use the Python requests
library and do an HTTP GET request to get tokens.
import requests
data = requests.get(host+'/identity/oauth/token',
params…