I am trying to automate orders from Miva to our accounting system and I want to pull orders using the JSON API OrderList_Load_Query. I only want to pull orders from a certain date and time say orders submitted from todays date. I seem to be having trouble in returning the orders for the current date. My results are from 2016 year.
Here is my JSON Request in Powershell, I would like it to return orders from just the current date:
$Date = Get-Date
$Date = ([DateTimeOffset]$Date).ToUnixTimeSeconds()
$body = @{
Store_Code = $storeCode
Function = 'OrderList_Load_Query'
Count = '0'
Offset = '0'
Filter = @(
@{
name = "search"
value = @(
@{
field = "orderdate"
operator = "EQ"
value = "$Date"
}
)
}
)
}
if ( $includeTimestamp )
{
$body["Miva_Request_Timestamp"] = [DateTimeOffset]::Now.ToUnixTimeSeconds()
}
$body = $body | ConvertTo-Json
Here is my JSON Request in Powershell, I would like it to return orders from just the current date:
$Date = Get-Date
$Date = ([DateTimeOffset]$Date).ToUnixTimeSeconds()
$body = @{
Store_Code = $storeCode
Function = 'OrderList_Load_Query'
Count = '0'
Offset = '0'
Filter = @(
@{
name = "search"
value = @(
@{
field = "orderdate"
operator = "EQ"
value = "$Date"
}
)
}
)
}
if ( $includeTimestamp )
{
$body["Miva_Request_Timestamp"] = [DateTimeOffset]::Now.ToUnixTimeSeconds()
}
$body = $body | ConvertTo-Json
Comment