Chang fulfillment status to shipped via api

jak82
New Member
9 0 0

Hi,

 

I have the following Powershell code to retrieve the list of orders

 

$uri = "https://home-everything.myshopify.com/admin/api/2021-04/orders.json?financial_status=paid&fulfillment_status=unshipped&limit=250"
$apikey = "apikey"
$password = "password"
$headers = @{"Authorization" = "Basic "+[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($apikey+":"+$password))}
$file = Invoke-WebRequest -Uri $uri -contentType  "application/json" -Method Get -Headers $headers -UseBasicParsing | ConvertFrom-Json 

 

 
How would I go about setting a particular order name/number fulfilment status to be shipped? 
 
Thanks for help
 
 
0 Likes
jak82
New Member
9 0 0

Something similar to

 

$uri = "https://home-everything.myshopify.com/admin/api/2021-04/orders/150099.json"
$order = @{
    fulfillment_status='fulfilled'
}
$apikey = "apikey"
$password = "password"
$headers = @{"Authorization" = "Basic "+[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($apikey+":"+$password))}
$body = (ConvertTo-Json $order)
$file = Invoke-RestMethod -Uri $uri -Method Post -Body $body -ContentType 'application/json' -Headers $headers -UseBasicParsing

 

This does not work however and returns the following error

Invoke-RestMethod: C:\Powershell Scripts\test.ps1:9:9
Line |
9 | $file = Invoke-RestMethod -Uri $uri -Method Post -Body $body -Content …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Response status code does not indicate success: 406 (Not Acceptable).

 

 

0 Likes
jak82
New Member
9 0 0

Hi,

 

I am still struggling with this.

Can anyone advise?

 

 

 

$uri = "https://ahome-everything.myshopify.com/admin/api/2021-04/orders/*orderid*.json"
$order = @{
    fulfillment= {
        location_id= null,
        fulfillment_status="fulfilled"}    
}
$apikey = "apikey"
$password = "password"
$headers = @{"Authorization" = "Basic "+[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($apikey+":"+$password))}
$body = (ConvertTo-Json $order)

$body
$file = Invoke-RestMethod -Uri $uri -Method Put -Body $body -ContentType 'application/json' -Headers $headers -UseBasicParsing

 

This is still failing with....
 
$file = Invoke-RestMethod -Uri $uri -Method Put -Body $body -ContentT …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| {"errors":{"order":"Required parameter missing or invalid"}}
0 Likes