Query catalog by content ID

This commit is contained in:
John Doty 2015-03-31 13:24:25 -07:00
parent b9188a0e4f
commit 07123ae409

View file

@ -322,4 +322,20 @@ function Get-ProductById(
{
$x = Invoke-WebRequest "https://displaycatalog.md.mp.microsoft.com/products/$($ProductId)?fieldsTemplate=Full&market=$($Market)&language=$($Language)" -Headers @{ 'MS-Contract-Version'=5; }
return convertfrom-json $x.Content
}
}
function Get-ProductByContentId(
[string]$ContentId,
[switch]$Raw,
[string]$Market='US',
[string]$Language='en-US')
{
$x = Invoke-WebRequest "https://displaycatalog.md.mp.microsoft.com/skus?rank=ContentId&count=1&alternateId=$($ContentId)&market=$($Market)&language=$($Language)&fieldsTemplate=Full" -Headers @{ 'MS-Contract-Version'=5; }
if ($Raw) {
return $x.Content
} else {
$y = convertfrom-json $x.Content
return $y.DisplaySkuSearchResult.Products[0]
}
}