Hi, I have managed to export a Postman API to Python and managed to run this in Python to obtain data. I now need to convert this python script into M Language to avoid having to use gateways when publishing to PBI Service as otherwise the dataset will not refresh but I can’t find any useful info on how to do this, so any help would be appreciated, thanks.
Python script - sensitive data replaced with x:
import pandas as pd
import requests
import json
url = “https://xxxxxxxxxx.execute-api.eu-west-2.amazonaws.com/Live/getcontracts”
payload={}
headers = {
‘authorizationToken’: ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’,
‘user_group_type_id’: ‘8’
}
response = requests.request(“GET”, url, headers=headers, data=payload)
my_string = response.content.decode(‘utf-8’)
data = json.loads (my_string)
df = pd.DataFrame (data)
print(df)