I'm trying to automate creating an organization in Meraki and configure it with the Meraki API. I use powershell but it's the endpoints really that I am looking for.
So I have an API key created. I keep it in Secret Server so that I can retrieve it with code.
$apikey = get-the-key-from Secret-Server
I can create a header.
$Global:Headers = @{
'X-Cisco-Meraki-API-Key' = "$($apikey)"
}
$baseURI = 'https://api.meraki.com/api/v1'
$ContentType = 'application/json'
I can clone an organization from out gold-template
$EndpointDataURI = 'organizations'
$FullURI = "$baseURI/$EndpointDataURI"
Get the golgentemplate
$allOrgs = Invoke-RestMethod -Uri $FullURI -ContentType $ContentType -Headers $Headers -Method GET
$goldenOrg = $allOrgs | where {$_.name -eq "gold-template"}
Clone the new organization
$newOrgName = "MyNewOrg"
$EndpointDataURI = "organizations/$goldenOrgID/clone"
$body = @{ "name" = $newOrgName }
$bodyjson = $body | convertto-json
$FullURI = "$baseURI/$EndpointDataURI"
Run the command
$newOrg = Invoke-RestMethod -Uri $FullURI -ContentType $ContentType -body $bodyjson -Headers $Headers -Method POST
Get the new org ID
$newOrgID = $newOrg.id
So now the new organization has been created and I can get it's ID.
Next under Network-Wide > Configure > General > Cisco Umbrella account, I want to add the umbrella key and secret. These have already been created in umbrella, and stored in Secret Server.
So I am looking for help for the URL and endpoint to configure these fields with the API.
I imagine it would be something like:
$EndpointDataURI = "organizations/$newOrgID/pathToUnrellaSettings&key=abcd&secret=1234"
$FullURI = "$baseURI/$EndpointDataURI"
or maybe key and secret are in a json body
Invoke-RestMethod -Uri $FullURI -ContentType $ContentType -Headers $Headers -Method POST
I looked through documentation but could not find what I needed.
any help with this would be greatly appreciated.
thanks