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¶
- Create
DistributionRequestand stampUsernamewithPremAudit(BR-AAC-010). - Populate
BaseDocumentXMLfrom the caller input and allocate a single-elementDistributionsarray (BR-AAC-011). - Inside that one
DistributionConfig, leaveDistributionGroupandRecipientNameempty and setDistributionTimetonullfor immediate distribution (BR-AAC-012). - Create
DocumentConfigwith the caller's package name,OutputProfile = PDF, andRecipientId = PH(BR-AAC-013, BR-AAC-014). - Leave
BannerInstructionsandSpecialHandlingempty and populateCoverSheetswith a single empty string (BR-AAC-015). - Attach the caller-supplied
DistributionOptionsand POST the assembled request to/v1/distribute. - Return
trueonly when the response status code isHttpStatusCode.OK(BR-AAC-016). - If request assembly or posting throws, write the exception message to
Consoleand returnfalseinstead 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.
Related documentation¶
Sources¶
Business\SAIF.Business.Policy.Audit.ApiCalls\DocumentApiCall.cs