Skip to content

Generate and distribute a document through the Document API

Build a one-distribution Document API request and post it to /v1/distribute.

Field Value
Operation ID OP-005
Trigger A caller invokes CallDocumentApi(packageName, documentXml, options).
Inputs string packageName, string documentXml, DistributionOptions options.
Outputs bool success flag.
Primary components DocumentApiCall.CallDocumentApi
Entry point Business\SAIF.Business.Policy.Audit.ApiCalls\DocumentApiCall.cs

Steps

  1. Create DistributionRequest and stamp Username with PremAudit (BR-AAC-010).
  2. Populate BaseDocumentXML from the caller input and allocate a single-element Distributions array (BR-AAC-011).
  3. Inside that one DistributionConfig, leave DistributionGroup and RecipientName empty and set DistributionTime to null for immediate distribution (BR-AAC-012).
  4. Create DocumentConfig with the caller's package name, OutputProfile = PDF, and RecipientId = PH (BR-AAC-013, BR-AAC-014).
  5. Leave BannerInstructions and SpecialHandling empty and populate CoverSheets with a single empty string (BR-AAC-015).
  6. Attach the caller-supplied DistributionOptions and POST the assembled request to /v1/distribute.
  7. Return true only when the response status code is HttpStatusCode.OK (BR-AAC-016).
  8. If request assembly or posting throws, write the exception message to Console and return false instead of rethrowing (BR-AAC-017).

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
  Start([CallDocumentApi]) --> Build[Build DistributionRequest]
  Build --> Post[POST /v1/distribute]
  Post --> Decision{HTTP 200?}
  Decision -->|Yes| Good([Return true])
  Decision -->|No| Bad([Return false])

Failure and edge-case behavior

  • Exceptions are swallowed after their message is written to Console.
  • Any non-200 response is treated as unsuccessful.

Sources

  • Business\SAIF.Business.Policy.Audit.ApiCalls\DocumentApiCall.cs