I work for a Microsoft Partner and we are a Cloud Solution Provider. The CSP Program has a wonderful ReST API I would like to turn into a PowerShell module for my personal edification and to easy some of my daily tasks with deploying a ASP.NET website. The problem I have run into is when I call the API via Invoke-RestMethod I get a srtring that kind of looks like a JSON Object but I cant convert it from json. Belwo is my code for the Invoke-Restmethod. Can anyone see an issue with my code here?
Headers match info found here = https://msdn.microsoft.com/en-us/library/partnercenter/mt634673.aspx and the content type is “application/json;charset=utf-8”. I tried UseBasicParsing and -UserAgent Parameter as well to no avail.
Invoke-RestMethod -Method Get -Uri 'https://api.partnercenter.microsoft.com/v1/customers?size=40 HTTP/1.1' -Headers $headers3 -ContentType $contentType
Output is here as a string:
{"totalCount":1,"items":[{"id":"9c0000-0000-4000-8824-63f000000","companyProfile":{"tenantId9c0000-0000-4000-8824-63f000000","domain":"sndbx.onmicrosoft.com","companyName":"SandBox","links":{"sel f":{"uri":"/customers/9c0000-0000-4000-8824-63f000000/profiles/company","method":"GET","headers":[]}},"attributes":{"objectType":"CustomerCompanyProfile"}},"relationshipToPartner":"reseller","links":{"self":{" uri":"/customers/9c0000-0000-4000-8824-63f000000","method":"GET","headers":[]}},"attributes":{"objectType":"Customer"}}],"links":{"self":{"uri":"/customers","method":"GET","headers":[]}},"attributes":{"objectT ype":"Collection"}}