I can see the issue! The PUT endpoint is only sending the cabecalho section, but the Omie API requires nCodCli and the infAdic section even for updates. Let me fix this:
I've updated the PUT endpoint to include the required nCodCli field and the infAdic section that the Omie API expects even for updates. The API now sends the minimal required structure while still allowing you to update only specific fields.
I can see the service order test script. It's structured similarly to the working contract test script but uses different API endpoints and field structures:
Key Differences from Contracts:
"osCadastro" to /api/v1/servicos/os/ endpointField Structure:
Cabecalho (vs cabecalho for contracts)InformacoesAdicionais (vs infAdic for contracts)ServicosPrestados array (vs itensContrato for contracts)impostos), service codes, quantitiesThe script follows the same successful pattern as your working contract test script - using Node.js https module with proper headers and response handling. This should work well for testing service order creation with the Omie API.
To configure the generation, complete these steps:
scripts/test-omie-postserviceorder.js[eval]:62 const postData = JSON.stringify(testPayload) ^^^^^ SyntaxError: Unexpected token 'const' [90m at makeContextifyScript (node:internal/vm:185:14)[39m [90m at node:internal/process/execution:107:22[39m at [eval]-wrapper:6:24 [90m at runScript (node:internal/process/execution:101:62)[39m [90m at evalScript (node:internal/process/execution:136:3)[39m [90m at node:internal/main/eval_string:55:3[39m