Posts

Showing posts from April, 2017

Powershell: How to get REST API data in JSON format rather than XML using invoke-restmethod

Image
Summary: I was exploring a REST API interface for an internal tool being built.  Being that I'm so accustomed to  powershell, I wanted to explore how I could get data from it.  The Invoke-RestMethod is perfect for this, but I was having issues getting data back in straight json format.  Data kept coming back in ugly as hell xml format by default. Details: The short answer was that I need to make a hash table to pass to the -Header parameter of the invoke-method cmdlet.  Basically, it looks like this: $Headers = @{"Accept" = "application/json"} Invoke-RestMethod -URI "https://myrestapi/endpoint" -Method:Get -Headers $Headers Once I did this, I received the data back in json format and powershell automatically captures it as a system.array object.  Making it immensely easier to work with rather than the xml return.  See below pictures as examples of the difference. Json returned data. xml returned data As you can see, the return I recei

VMware: ESXi 6 503 Service Unavailable endpoint: [N7Vmacore4Http16LocalServiceSpecE:0x1f098b08] _serverNamespace = / _isRedirect = false _port = 8309)

Image
Summary: Basically I enabled SR-IOV on the only two pNIC's I had in my ESXi host in my lab.  This doesn't necessarily cause a connectivity problem, but the ESXi management agents did not like this at all.  Meaning I could connect to my hosts, as evident in the error message, but the agents basically broke once SR-IOV was enabled on the only two physical uplinks I had. Workaround: Unfortunately, the only workaround I've found is to: "Reset System Configuration" from DCUI This basically bring ESXi back to default install config.  root password is blanked out, etc. etc. or Re-Deploy the host.  For my testing though, I can enable on one of the physical uplinks and work w/ that just fine, just not both in my case.  The other aspect that I didn't realize is that the CNA cards I was using lose their Fiber Channel connectvity as well. SR-IOV effectively changed my CNA cards to NIC adapters only. Config: ESXi 6.0 Build 5050593 Dell FX2 - FC630 -