... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)

2012-12-12

curl vs. Windows vs. esi.manage measure export

A self-contained Windows command file can use curl to invoke the esi.manage measure export integration service through judicious use of newline and quote escaping:

@ECHO OFF

SETLOCAL

SET server=127.0.0.1:8080

SET request=^
  -h ^
  -g PROJECT.NAME ^
  -c none        -m PRODUCTION -b GROSS -v FORECAST -U Oil:boe -D NONE        --curtailment ^
  -c scheduled   -m PRODUCTION -b GROSS -v FORECAST -U Oil:boe -D SCHEDULED   --curtailment ^
  -c unscheduled -m PRODUCTION -b GROSS -v FORECAST -U Oil:boe -D UNSCHEDULED --curtailment ^
  -c all         -m PRODUCTION -b GROSS -v FORECAST -U Oil:boe -D ALL         --curtailment ^
 2010-01-01 ^
 18 M ^
 \"origin subset\"

curl ^
  --ntlm ^
  --user : ^
  -X POST ^
  -H "content-type:text/plain" ^
  --data-binary "%request%" ^
  http://%server%/3esi/manage/integration/export

The use of the --data-binary option is important since -d or --data-ascii will reformat the data (e.g. strip newlines).

Blog Archive