I've been attempting to create an organization-level payload template, as described here: https://developer.cisco.com/meraki/api-v1/create-organization-webhooks-payload-template/
To preface: I've been able to create templates at the network level just fine, but would like to have the same template available across multiple networks. Not being able to use the same name for each network level template makes creating them individually undesirable, but I'm willing to do it once I've ruled out other options.
I have early access for the API enabled. The Python code I've successfully been using is as follows:
headers = {
"X-Cisco-Meraki-API-Key": API_KEY
}
def get_organizations():
url = f"{API_URL}/organizations"
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
def create_org_template(organization_id😞
sharing = json.dumps({"byNetwork":{"withAll":True,"adminsCanModify":True,"ids":[]}})
files = [
('headersFile', ('customTemplate.headers.liquid', open('headers.liquid', 'rb'),'application/octet-stream')),
('bodyFile', ('customTemplate.body.liquid', open('body.liquid','rb'),'application/octet-stream')),
('name', (None, 'Jira'))
]
url = '{}/organizations/{}/webhooks/payloadTemplates'.format(API_URL, organization_id)
response = requests.post(url, files=files, headers=headers)
print(response.json())
response.raise_for_status()
organization_id = get_organizations()[0]["id"]
create_org_template(organization_id)
However, when I add the following tuple to the files list in create_org_template I get an error stating that 'sharing' must be an object:
('sharing', (None, sharing, 'application/json'))
Any ideas on how to resolve this?
Cheers!