Using API's with Powershell - Shopify

Christopher Jack 1,616 Reputation points
2021-04-07T15:48:31.937+00:00

Hi,

I am trying to get API's working with Powershell

I have the following code

$uri = "https://home-everything.myshopify.com/admin/api/2021-04/orders.json"
$apikey = "Username"
$password = "Password"
$headers = @{"Authorization" = "Basic "+[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($apikey+":"+$password))}
$products = Invoke-WebRequest -Uri $uri -contentType  "application/json" -Method   Get -Headers $headers | ConvertFrom-Json

However the error I am receiving is

Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer's first-launch configuration is not complete. Specify the UseBasicParsing parameter and try
again.

The URL I am trying to use that works in a browser is

https://username:******@home-everything.myshopify.com/admin/api/2021-04/orders.json

Any help appreciated.. trying to get this to work.

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Christopher Jack 1,616 Reputation points
    2021-04-07T15:53:22.227+00:00

    Added -usebasicparsing and it seemed to resolve the issue

    $products = Invoke-WebRequest -Uri $uri -contentType  "application/json" -Method Get -Headers $headers -UseBasicParsing | ConvertFrom-Json 
    
    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.