question

ChristopherJack-1763 avatar image
0 Votes"
ChristopherJack-1763 asked ChristopherJack-1763 edited

Using API's with Powershell - Shopify

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:Password@home-everything.myshopify.com/admin/api/2021-04/orders.json

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






windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ChristopherJack-1763 avatar image
0 Votes"
ChristopherJack-1763 answered ChristopherJack-1763 edited

Added -usebasicparsing and it seemed to resolve the issue

 $products = Invoke-WebRequest -Uri $uri -contentType  "application/json" -Method Get -Headers $headers -UseBasicParsing | ConvertFrom-Json 
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.