1

I am trying to automate a weekly process where I download a CSV copy from the Client page on the Meraki website.

Before I lose you I am aware there is an API and it works very well. However there in a device attribute that is not exposed in the API. I got this from their support:

At this point, the "Owner" field is not accessible through the API, and it is currently in development.

I need the Owner as that is how I associate devices to people in our organization.

Using PowerShell I am able to successfully log into the website and get a 200 response for a basic page. My problem comes when I try to use the same session to get to the data I want I keep getting a page with just breadcrumbs and no actual data.

# Browse the Meraki website
$response = Invoke-WebRequest -Uri "https://n116.meraki.com/login/dashboard_login" -SessionVariable meraki

# Form Credentials
$formFields = @{
    email = "my address"
    password = "my password"
}

# Authenticate to the site
Invoke-WebRequest -Uri $response.Forms.Action -WebSession $meraki -Body $formFields -Method Post
# Get the client list
Invoke-WebRequest -Uri "https://n116.meraki.com/my-company/n/_-tSGb0b/manage/pcc/list" -WebSession $meraki -Method Get

Worst case is I am hoping to get the parsedHtml of the Client List table so I can work with its contents. I can't seem to get any useful data no matter what page. I am not sure if the issue is working with Meraki or my PowerShell approach. I have only done simple scraping up until this point.

I realize this is a very specific request but I am curious to know if someone that has Meraki is able or has been able to get this information using these means.

Matt
  • 690
  • 6
  • 26
  • I have just used the CSV export option for my own purposes. But I don't need to refresh that data very often, so it works for me. – longneck Dec 30 '16 at 18:12
  • That is what I already do. If I can automate it then that is one less thing I have to worry about. I am trying to be effectively lazy. I need it more often since we have a policy concerning disk space on the clients. I need to check it often to enforce compliance. – Matt Dec 30 '16 at 18:16
  • The login process and websession seems to be working, since if it wasn't you'd get redirected to the login page. Check the request headers when you do it in the browser and make sure it's actually a GET request and not some kind of postback thing? – DerfK Dec 30 '16 at 18:22

0 Answers0