NAME

oEdtk::ECM - inject documents into the ECM and stamp their mailed date

SYNOPSIS

use oEdtk::ECM;

my $doc = oEdtk::ECM::send_document( $file, { id => 42 } );    # => decoded JSON
oEdtk::ECM::http_put_envoidate_for_iddoc( $doc->{iDoc}, '20260113' );

DESCRIPTION

Two calls against the ECM API, ported unchanged from the fork's oEUser::ECM (decision D22):

  • send_document uploads a file, with its index metadata as a JSON "text" form part, to /v1/documents/upload?apirole=EDITIQUE and returns the decoded JSON of the 201 response.

  • http_put_envoidate_for_iddoc stamps the MAILED state and an envoi_date on an existing document via PUT /v1/documents/id?apirole=EDITIQUE, and returns the decoded JSON of the 200 response.

Both authenticate with a static API key, not a token: the Authorization header is APIECM_APIKEY_EDITIQUE verbatim. The base URL is APIECM_URL; transport security comes from oEdtk::Net (verification ON by default). Each function takes an optional trailing configuration hashref -- the fork's two-argument form still works, defaulting to "config_read" in oEdtk::Config.

The fork's own name oEUser::ECM remains available as a delegate to this module.

FUNCTIONS

send_document

my $response = send_document($file_url, \%metadatas, $cfg);

Upload $file_url with its index metadata as a JSON form part, and return the decoded JSON of the 201 response.

http_put_envoidate_for_iddoc

my $response = http_put_envoidate_for_iddoc($docid, $date, $cfg);

Stamp the MAILED state and the mailed date on document $docid, and return the decoded JSON of the 200 response.

Both calls take an optional trailing configuration hash reference, defaulting to "config_read" in oEdtk::Config. The internal helpers _config, _url, _headers and _get_file_content are not part of the public API.

AUTHOR

The oEdtk team.