Files
MBS/WEBSERVICES/testrest/probar_datosCocina.ps1
T

23 lines
860 B
PowerShell

# Prueba del endpoint datos_cocinas del APIREST (restServer)
# Uso: .\probar_datosCocina.ps1 [fechaCorte] (ej: .\probar_datosCocina.ps1 2026-07-01)
param(
[string]$fechaCorte = "2026-07-01",
[string]$usuario = "conecta",
[string]$clave = "conecta"
)
$url = "https://ws.marmotech.com.do/gas/ws/r/restserver"
# 'data' es un STRING JSON escapado (el server hace util.JSON.parse sobre ese string)
$dataInner = ('{{"usuario":"{0}","clave":"{1}","fechaCorte":"{2}"}}' -f $usuario, $clave, $fechaCorte)
$body = @{ oper = "datos_cocinas"; data = $dataInner } | ConvertTo-Json -Compress
Write-Host "POST $url" -ForegroundColor Cyan
Write-Host "Body: $body" -ForegroundColor DarkGray
$resp = Invoke-RestMethod -Uri $url -Method Post -ContentType "dbsync/json" `
-Headers @{ "DBSync-Client" = "mbs" } -Body $body
$resp | Format-List