#!/bin/bash
# SendEdi214Data -- REST curl example
# Pre-configured for the DM Web Services test environment.
# Replace YOUR_TOKEN below with your Bearer token.
# POST the DM Load Number and the status-selection mode in a JSON body.
#   mode is an integer:
#     0 = NextUntransmitted (default) -- the earliest (oldest) not-yet-transmitted status;
#         marks it transmitted. Successive calls drain the queue oldest-first, one per call.
#     1 = AllUntransmitted -- every not-yet-transmitted status, oldest to newest; marks them all.
#     2 = FullHistory -- the full status history, read-only (marks nothing).
#   Omitting mode defaults to 0.
# This is a POST (not a GET) because modes 0 and 1 mutate state (they mark statuses transmitted).
# Also available over SOAP at /soap/public/v1/reports (operation SendEdi214Data).
BASE_URL="https://webservices.nebulasuite.net"
TOKEN="YOUR_TOKEN"

curl -X POST "${BASE_URL}/api/public/v1/reports/214" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "dmLoadNumber": 104857,
    "mode": 0
  }'
