@abgov/adsp-sdk-mcp-server 1.24.0 → 1.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -12
- package/assets/docs/getting-started.md +6 -5
- package/assets/docs/platform/deployment.md +1 -1
- package/assets/docs/platform/getting-started.md +3 -18
- package/assets/docs/platform/platform-flask-sdk.md +44 -0
- package/assets/docs/platform/platform-node-sdk.md +6 -5
- package/assets/docs/services/access-service.md +10 -12
- package/assets/docs/services/agent-service.md +49 -8
- package/assets/docs/services/audit-service.md +252 -133
- package/assets/docs/services/configuration-service.md +163 -59
- package/assets/docs/services/event-service.md +138 -33
- package/assets/docs/services/form-service.md +152 -12
- package/assets/docs/services/notification-service.md +2 -0
- package/assets/docs/services/pdf-service.md +7 -7
- package/assets/docs/services/pii-service.md +16 -0
- package/assets/docs/services/project-planner-service.md +11 -11
- package/assets/docs/services/push-service.md +3 -3
- package/assets/docs/services/services.md +44 -0
- package/assets/docs/services/status-service.md +162 -6
- package/assets/docs/services/token-handler.md +68 -10
- package/assets/docs/services/value-service.md +95 -9
- package/assets/docs/services/verify-service.md +20 -1
- package/assets/docs/tutorials/access-service/themes.md +1 -1
- package/assets/docs/tutorials/form-service/ai-agent.md +1 -1
- package/assets/docs/tutorials/form-service/building-forms.md +1 -1
- package/assets/docs/tutorials/form-service/cheat-sheet.md +1 -1
- package/assets/docs/tutorials/form-service/form-app.md +1 -1
- package/assets/docs/tutorials/form-service/form-submissions.md +1 -1
- package/assets/docs/tutorials/form-service/introduction.md +1 -1
- package/assets/docs/tutorials/form-service/security.md +1 -1
- package/assets/docs/tutorials/status-service/health.md +1 -1
- package/assets/docs/tutorials/status-service/status.md +2 -2
- package/package.json +1 -1
- package/src/docs/docsRepository.js +1 -5
- package/src/docs/docsRepository.js.map +1 -1
- package/src/metrics.js +2 -11
- package/src/metrics.js.map +1 -1
- package/src/sdk-reference/search.js +1 -1
- package/src/sdk-reference/search.js.map +1 -1
- package/src/search/aliases.d.ts +6 -0
- package/src/search/aliases.js +20 -0
- package/src/search/aliases.js.map +1 -0
- package/src/search/textSearch.d.ts +5 -0
- package/src/search/textSearch.js +15 -0
- package/src/search/textSearch.js.map +1 -1
- package/src/server.js +2 -1
- package/src/server.js.map +1 -1
- package/src/tools/registerDocsTools.js +63 -3
- package/src/tools/registerDocsTools.js.map +1 -1
- package/src/version.d.ts +7 -0
- package/src/version.js +20 -0
- package/src/version.js.map +1 -0
|
@@ -14,19 +14,65 @@ client `urn:ads:platform:form-service`
|
|
|
14
14
|
|
|
15
15
|
| name | description |
|
|
16
16
|
|:-|:-|
|
|
17
|
-
| form-admin | Administrator role for form service. This role allows a user to
|
|
18
|
-
| intake-application | Intake application role for form service. This role is used to grant a service account the ability to retrieve draft forms and submit forms on behalf of an anonymous applicant.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
| form-admin | Administrator role for form service. This role allows a user to manage form definitions, find and read all forms and submissions of the tenant, unlock, archive and delete forms, delete submissions, and manage data registers. |
|
|
18
|
+
| intake-application | Intake application role for form service. This role is used to grant a service account the ability to retrieve draft forms and submit forms on behalf of an anonymous applicant. |
|
|
19
|
+
| form-applicant | Applicant role for form service that allows a user to apply from the form app. It permits subscribing to the submitted form PDF and form question update streams. |
|
|
20
|
+
| form-support | Support role for viewing and responding to form question topics. It is a commenter role of the form questions comment topic type, and a subscriber role of the form message reviewer notifications. |
|
|
21
|
+
| form-file-reader | File reader role that allows assessors and clerks to review uploaded supporting documents. |
|
|
22
|
+
| form-file-uploader | File uploader role that allows applicants to upload supporting documents for the form. |
|
|
23
|
+
| form-tester | Tester role for form service that allows access to forms without open intakes. |
|
|
24
|
+
| form-service | Form service role used to permit deletion of orphaned form support document files. |
|
|
25
|
+
|
|
26
|
+
The data register API also accepts the configuration service role `urn:ads:platform:configuration-service:configuration-admin`, which tenant administrators have by default. Form and submission searches also accept the export service role `urn:ads:platform:export-service:export-job`.
|
|
27
|
+
|
|
28
|
+
Each form definition also names its own **applicant**, **clerk** and **assessor** roles. These are tenant roles, and they control who can create and fill in forms of the definition, and who can review its submissions.
|
|
29
|
+
|
|
30
|
+
## Tenancy
|
|
31
|
+
- **Which tenant is used.** Tenant users and service accounts act on the tenant of their token. Core (platform) users set the `tenantId` query parameter to choose the tenant. The form definition, form, submission, data register and intake schedule endpoints act on one tenant, so core users must set `tenantId` on them.
|
|
32
|
+
- **Anonymous requests.** Only `GET /form/v1/definitions/{definitionId}` allows anonymous requests, for definitions that allow anonymous applications. Anonymous requests have no token to determine the tenant from, so they must include `tenantId`; without it the request responds 400.
|
|
33
|
+
- **Form definitions.** Form definitions are tenant configuration in the [configuration service](configuration-service.md). Form service uses the tenant's own definitions and does not fall back to platform definitions.
|
|
34
|
+
- **Isolation.** Forms and submissions are stored with the ID of their tenant. A form or submission ID from another tenant responds 404, not 403.
|
|
35
|
+
- **Role scope.** The roles of a form definition must be held in the tenant. Most `form-admin` checks also accept a core user with the role, but listing definitions, reading a definition, finding submissions and setting a form back to draft need the role in the tenant. The `export-job` role is accepted from core service accounts.
|
|
36
|
+
|
|
37
|
+
## API overview
|
|
38
|
+
All endpoints are under `https://form-service.adsp.alberta.ca/form/v1`. See the [API documentation](https://api.adsp.alberta.ca) for request and response schemas.
|
|
39
|
+
|
|
40
|
+
| Endpoint | Purpose | Required role |
|
|
41
|
+
|:-|:-|:-|
|
|
42
|
+
| `GET /form/v1/definitions` | List and search form definitions. | `form-admin` |
|
|
43
|
+
| `POST /form/v1/definitions` | Create a form definition from a name and description. | `form-admin` |
|
|
44
|
+
| `GET /form/v1/definitions/{definitionId}` | Read a form definition and its current intake. | `form-admin`, `intake-application`, or the definition's applicant or clerk roles; anonymous for definitions that allow anonymous applications |
|
|
45
|
+
| `PUT`, `PATCH`, `DELETE /form/v1/definitions/{definitionId}` | Replace, update or delete a form definition. | `form-admin` |
|
|
46
|
+
| `PUT /form/v1/definitions/{definitionId}/schemas` | Update the data and UI schemas. | `form-admin` |
|
|
47
|
+
| `PUT /form/v1/definitions/{definitionId}/roles` | Replace the applicant, assessor and clerk roles. | `form-admin` |
|
|
48
|
+
| `PATCH /form/v1/definitions/{definitionId}/lifecycle` | Update the anonymous application, applicant limit, support topic and security classification settings. | `form-admin` |
|
|
49
|
+
| `PATCH /form/v1/definitions/{definitionId}/submission-actions` | Update what happens when a form is submitted. | `form-admin` |
|
|
50
|
+
| `PUT /form/v1/definitions/{definitionId}/schedule` | Update the scheduled intake period. | `form-admin` |
|
|
51
|
+
| `GET /form/v1/forms` | Find forms. | Any signed-in user; `form-admin` and `export-job` find all forms, assessors find the submitted forms of their definition, and other users find the forms they created |
|
|
52
|
+
| `POST /form/v1/forms` | Create a draft form, and optionally submit it. | The definition's applicant or clerk roles; `intake-application` for definitions that allow anonymous applications |
|
|
53
|
+
| `GET /form/v1/forms/{formId}` | Read a form. | `form-admin`, `intake-application`, the definition's clerk or assessor roles, or the applicant who created it |
|
|
54
|
+
| `POST /form/v1/forms/{formId}` | Run a form operation: `send-code`, `unlock`, `submit`, `to-draft` or `archive`. | Depends on the operation (see the API documentation) |
|
|
55
|
+
| `DELETE /form/v1/forms/{formId}` | Delete a form and its files. | `form-admin`; the definition's clerk roles or the applicant who created it, for draft forms |
|
|
56
|
+
| `GET`, `PUT /form/v1/forms/{formId}/data` | Read or update the form data. | The applicant who created it or the definition's clerk roles; reading also allows `form-admin`, assessors of submitted forms, and `intake-application` with a verification code |
|
|
57
|
+
| `GET /form/v1/submissions`, `GET /form/v1/forms/{formId}/submissions` | Find submissions. | `form-admin`, `export-job`, or the definition's assessor roles |
|
|
58
|
+
| `GET /form/v1/submissions/{submissionId}`, `GET /form/v1/forms/{formId}/submissions/{submissionId}` | Read a submission. | `form-admin` or the definition's assessor roles |
|
|
59
|
+
| `POST /form/v1/forms/{formId}/submissions/{submissionId}` | Disposition a submission. | `form-admin` or the definition's assessor roles |
|
|
60
|
+
| `POST /form/v1/forms/{formId}/submissions/{submissionId}/notes`, `DELETE .../notes/{noteId}` | Add or remove a reviewer note. | `form-admin` or the definition's assessor roles |
|
|
61
|
+
| `DELETE /form/v1/submissions/{submissionId}` | Delete a submission. | `form-admin` |
|
|
62
|
+
| `/form/v1/registers` | Manage data registers (see [Data registers](#data-registers)). | `form-admin` or `configuration-admin` |
|
|
63
|
+
|
|
64
|
+
Form definitions are stored in the configuration service, so they can also be managed through the configuration service API.
|
|
22
65
|
|
|
23
66
|
## Concepts
|
|
24
67
|
### Form definition
|
|
25
|
-
Form definition describes a type of form including the allowed applicant and assessor roles and whether anonymous applicants are permitted. Form definitions are configured in the [configuration service](configuration-service.md) under the `
|
|
68
|
+
Form definition describes a type of form including the allowed applicant and assessor roles and whether anonymous applicants are permitted. Form definitions are configured in the [configuration service](configuration-service.md) under the `form-service` namespace, with the definition ID as the name.
|
|
26
69
|
|
|
27
70
|
### Form
|
|
28
71
|
Form represents a particular instance of an application including the information entered by the *applicant*. Each form is associated with a *definition* and has a status. Statuses represent the lifecycle steps of the form and include: Draft, Locked, Submitted, and Archived.
|
|
29
72
|
|
|
73
|
+
### Submission
|
|
74
|
+
When a form is submitted and its definition has submission records enabled, form service creates a *submission* with a copy of the form data. Assessors review submissions, add notes, and record a *disposition* using one of the definition's disposition states. A form that is set back to draft and submitted again gets a new submission.
|
|
75
|
+
|
|
30
76
|
### Draft expiry
|
|
31
77
|
Draft forms include an expiry process so that information entered into draft forms are purged if the draft is abandoned. If a draft form is not accessed for some expiry period, the form is locked and the applicant is notified. In this state, the form cannot be accessed by the applicant but can be unlocked by an administrator. If the form remains in a locked state for some additional expiry period, the form is deleted so that applicant information is not unnecessarily retained.
|
|
32
78
|
|
|
@@ -67,6 +113,30 @@ Registers are returned as `{ namespace: 'data-register', name, description, entr
|
|
|
67
113
|
|
|
68
114
|
Form service does not emit its own events for data registers. Configuration service emits `configuration-updated` and `configuration-deleted` for the underlying configuration.
|
|
69
115
|
|
|
116
|
+
## Events
|
|
117
|
+
Form service sends these domain events in the `form-service` namespace. Form events use the form ID as the correlation ID.
|
|
118
|
+
|
|
119
|
+
| name | sent when |
|
|
120
|
+
|:-|:-|
|
|
121
|
+
| form-created | A draft form is created. When a form is created with `submit: true`, `form-submitted` is sent instead. |
|
|
122
|
+
| form-locked | The draft expiry job locks a draft that has not been accessed. |
|
|
123
|
+
| form-unlocked | An administrator unlocks a locked form. |
|
|
124
|
+
| form-submitted | A form is submitted. The form data is included when the definition sets `includeDataInSubmission`. |
|
|
125
|
+
| form-to-draft | A submitted form is set back to draft. |
|
|
126
|
+
| form-archived | A form is archived. |
|
|
127
|
+
| form-deleted | A form is deleted through the API or by the draft expiry job. |
|
|
128
|
+
| submission-dispositioned | A submission is dispositioned. |
|
|
129
|
+
| submission-deleted | A submission is deleted. |
|
|
130
|
+
| form-message-to-applicant | A reviewer posts a message on a form's questions topic. |
|
|
131
|
+
| form-message-to-reviewer | An applicant posts a message and a reviewer is part of the conversation. |
|
|
132
|
+
| form-message-forwarded | An applicant posts a message, no reviewer is part of the conversation, and the definition sets an address to forward questions to. |
|
|
133
|
+
|
|
134
|
+
When a definition sets a custom submission event (`event` in the submission actions), form service also sends that event, in the namespace and with the name it configures, each time a form is submitted.
|
|
135
|
+
|
|
136
|
+
Form service registers the `form-status-updates`, `form-message-notifications` and `form-message-reviewer-notifications` notification types, which notify applicants and reviewers of these events. It also registers two push service streams: `submitted-form-pdf-updates` (PDF service PDF generation events) and `form-questions-updates` (comment service events on form question topics).
|
|
137
|
+
|
|
138
|
+
Form service consumes the comment service `comment-created` event for form question topics to send the message events above.
|
|
139
|
+
|
|
70
140
|
## Audit actions
|
|
71
141
|
Form service records audit events in the `form-service` namespace of the [audit service](audit-service.md). Records are written to the tenant of the form, submission or data register. Form records use the form as the resource (`{ type: 'form', id: <form ID> }`) and correlation ID, with the form `definitionId`, `status` (after the operation), `anonymousApplicant` and `dryRun` in the metadata. Form data and applicant details are never recorded. All actions are version 1.
|
|
72
142
|
|
|
@@ -98,6 +168,43 @@ Draft data is saved frequently, so form service sends audit events in batches of
|
|
|
98
168
|
Audit recording is on by default. Set the environment variable `FORM_AUDIT_ENABLED=false` on form service to turn it off, or `true` to turn it on regardless of the SDK `AUDIT_ENABLED` variable, which applies when `FORM_AUDIT_ENABLED` is not set. The action catalog is still registered while recording is off, so turning it back on needs only a restart.
|
|
99
169
|
|
|
100
170
|
## Code examples
|
|
171
|
+
### Create a form definition
|
|
172
|
+
```typescript
|
|
173
|
+
const response = await fetch(
|
|
174
|
+
'https://form-service.adsp.alberta.ca/form/v1/definitions',
|
|
175
|
+
{
|
|
176
|
+
method: 'POST',
|
|
177
|
+
headers: {
|
|
178
|
+
'Authorization': `Bearer ${accessToken}`,
|
|
179
|
+
'Content-Type': 'application/json',
|
|
180
|
+
},
|
|
181
|
+
body: JSON.stringify({
|
|
182
|
+
name: 'Business licence application',
|
|
183
|
+
description: 'Application for a municipal business licence.',
|
|
184
|
+
}),
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
// The ID is generated from the name, for example 'business-licence-application'.
|
|
189
|
+
const { id, revision } = await response.json();
|
|
190
|
+
|
|
191
|
+
// Set who can apply and who can assess submissions.
|
|
192
|
+
await fetch(
|
|
193
|
+
`https://form-service.adsp.alberta.ca/form/v1/definitions/${id}/roles`,
|
|
194
|
+
{
|
|
195
|
+
method: 'PUT',
|
|
196
|
+
headers: {
|
|
197
|
+
'Authorization': `Bearer ${accessToken}`,
|
|
198
|
+
'Content-Type': 'application/json',
|
|
199
|
+
},
|
|
200
|
+
body: JSON.stringify({
|
|
201
|
+
applicantRoles: ['business-licence-applicant'],
|
|
202
|
+
assessorRoles: ['business-licence-assessor'],
|
|
203
|
+
}),
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
```
|
|
207
|
+
|
|
101
208
|
### Create a draft form for an anonymous applicant
|
|
102
209
|
```typescript
|
|
103
210
|
const form = {
|
|
@@ -125,12 +232,12 @@ Audit recording is on by default. Set the environment variable `FORM_AUDIT_ENABL
|
|
|
125
232
|
|
|
126
233
|
const {
|
|
127
234
|
id,
|
|
128
|
-
|
|
235
|
+
definition,
|
|
129
236
|
status,
|
|
130
237
|
created,
|
|
131
238
|
createdBy,
|
|
132
239
|
lastAccessed,
|
|
133
|
-
} = response.json();
|
|
240
|
+
} = await response.json();
|
|
134
241
|
```
|
|
135
242
|
|
|
136
243
|
### Access form data using a time limited code.
|
|
@@ -167,12 +274,13 @@ Intake applications can retrieve form data on behalf of anonymous applicants by
|
|
|
167
274
|
```
|
|
168
275
|
|
|
169
276
|
### Update data in a draft form
|
|
277
|
+
Files are referenced by their file service URN in the data. Form service finds the file references using the data schema, and returns them in `files`.
|
|
170
278
|
```typescript
|
|
171
279
|
const formData = {
|
|
172
|
-
data: {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
280
|
+
data: {
|
|
281
|
+
businessName: 'Example Bakery Ltd.',
|
|
282
|
+
proofOfStatus: fileUrn,
|
|
283
|
+
},
|
|
176
284
|
}
|
|
177
285
|
|
|
178
286
|
const response = await fetch(
|
|
@@ -213,5 +321,37 @@ Intake applications can retrieve form data on behalf of anonymous applicants by
|
|
|
213
321
|
id,
|
|
214
322
|
status,
|
|
215
323
|
submitted,
|
|
324
|
+
submission,
|
|
216
325
|
} = await response.json();
|
|
217
326
|
```
|
|
327
|
+
|
|
328
|
+
### Disposition a submission
|
|
329
|
+
Assessors find the submissions of a definition that are waiting for a decision, and record a disposition using one of the definition's disposition states.
|
|
330
|
+
```typescript
|
|
331
|
+
const criteria = JSON.stringify({ definitionIdEquals: definitionId, dispositioned: false });
|
|
332
|
+
const response = await fetch(
|
|
333
|
+
`https://form-service.adsp.alberta.ca/form/v1/submissions?criteria=${encodeURIComponent(criteria)}`,
|
|
334
|
+
{
|
|
335
|
+
headers: { Authorization: `Bearer ${accessToken}` },
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
const { results, page } = await response.json();
|
|
339
|
+
|
|
340
|
+
const [{ id: submissionId, formId }] = results;
|
|
341
|
+
const dispositionResponse = await fetch(
|
|
342
|
+
`https://form-service.adsp.alberta.ca/form/v1/forms/${formId}/submissions/${submissionId}`,
|
|
343
|
+
{
|
|
344
|
+
method: 'POST',
|
|
345
|
+
headers: {
|
|
346
|
+
'Authorization': `Bearer ${accessToken}`,
|
|
347
|
+
'Content-Type': 'application/json',
|
|
348
|
+
},
|
|
349
|
+
body: JSON.stringify({
|
|
350
|
+
dispositionStatus: 'Approved',
|
|
351
|
+
dispositionReason: 'Application meets all eligibility criteria.',
|
|
352
|
+
}),
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
const { disposition } = await dispositionResponse.json();
|
|
357
|
+
```
|
|
@@ -47,6 +47,8 @@ All endpoints are under `https://notification-service.adsp.alberta.ca/subscripti
|
|
|
47
47
|
|
|
48
48
|
There are no separate template or event endpoints. Templates are part of each notification type's `events`, and events are sent through the [event service](event-service.md).
|
|
49
49
|
|
|
50
|
+
`POST /provider/v1/bot/messages` is the Bot Framework webhook used by the `bot` channel provider. Only the Bot Framework calls it, so it is not part of the API documentation.
|
|
51
|
+
|
|
50
52
|
## Concepts
|
|
51
53
|
### Notification type
|
|
52
54
|
Notification type represents a bundled set of notifications that can be subscribed to and provides the access roles for that set. For example, an 'Application Progress' type could include notifications for submission of the application, processing started, and application processed. A subscriber has a subscription to the set and cannot subscribe to the individual notifications in the set. Notification types are configured in the [configuration service](configuration-service.md) under the `platform:notification-service` namespace and name.
|
|
@@ -77,17 +77,17 @@ These events are available on the [push service](push-service.md) stream `pdf-ge
|
|
|
77
77
|
|
|
78
78
|
## Audit actions
|
|
79
79
|
|
|
80
|
-
PDF service records audit events in the `pdf-service` namespace of the [audit service](audit-service.md).
|
|
80
|
+
PDF service records audit events in the `pdf-service` namespace of the [audit service](audit-service.md). Records are written to the tenant of the job or template. All actions are version 1, and their retention class is derived from the category.
|
|
81
81
|
|
|
82
82
|
| action | category | severity | retention class | recorded when |
|
|
83
83
|
|:-|:-|:-|:-|:-|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
84
|
+
| job.created | runtime | info | standard | A PDF generation job is queued through `POST /pdf/v1/jobs`. |
|
|
85
|
+
| job.generated | runtime | info | standard | A generation job finishes: status `success` when the PDF is stored in file service, with the resulting `fileId` in the metadata, or status `failure` when the job fails, with the `error` in the metadata. |
|
|
86
|
+
| template.created | administrative | info | compliance | A template is created through `POST /pdf/v1/templates`. |
|
|
87
|
+
| template.updated | administrative | warning | compliance | A template is updated through `PATCH /pdf/v1/templates/{templateId}`, with the names of the changed fields as `changedFields` in the metadata. |
|
|
88
|
+
| template.deleted | administrative | warning | compliance | A template is deleted through `DELETE /pdf/v1/templates/{templateId}`. |
|
|
89
89
|
|
|
90
|
-
Job records have the job as the resource (`{ type: 'pdf-job', id: <job ID>, name: <filename> }`), the `recordId` of the generated file as the correlation ID, and the `templateId`, `filename`, `fileType` and `recordId` in the metadata. Since file service uses the same `recordId` as the correlation ID, the `fileId` and correlation ID link a job to the `file.uploaded` record of the generated file. `
|
|
90
|
+
Job records have the job as the resource (`{ type: 'pdf-job', id: <job ID>, name: <filename> }`), the `recordId` of the generated file as the correlation ID, and the `templateId`, `filename`, `fileType` and `recordId` in the metadata. Since file service uses the same `recordId` as the correlation ID, the `fileId` and correlation ID link a job to the `file.uploaded` record of the generated file. `job.generated` is recorded by the job worker after generation completes, with the requester of the job as the actor; a failure is recorded only when the job is marked failed, not on an attempt that will be retried. Failures are found by filtering on `status=failure`.
|
|
91
91
|
|
|
92
92
|
Template records have the template as the resource (`{ type: 'pdf-template', id: <template ID>, name: <name> }`) and the `templateId` and `name` in the metadata. Template changes made directly in the [configuration service](configuration-service.md) rather than through the PDF service API are recorded only in the `configuration-service` namespace; changes through the PDF service API are recorded in both. Reads of templates and job status are not recorded.
|
|
93
93
|
|
|
@@ -21,6 +21,22 @@ Entities represent categories of objects found in language. Presidio is based on
|
|
|
21
21
|
### Recognizer
|
|
22
22
|
Recognizers are extensible components used by Presidio to identify PII entities. PII service adds recognizers for Canadian bank account number, passport, postal code, and social insurance number.
|
|
23
23
|
|
|
24
|
+
## Audit
|
|
25
|
+
Analyze and anonymize requests are recorded in the [audit service](/adsp-monorepo/services/audit-service.html) under the `pii-service` namespace. All actions use the `security` category, and their retention class is derived from it.
|
|
26
|
+
|
|
27
|
+
| Action | Severity | Recorded when |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| `text.analyzed` | info | An analyze request completes. |
|
|
30
|
+
| `text.anonymized` | info | An anonymize request completes. |
|
|
31
|
+
| `text.analyze-failed` | warning | An analyze request fails with a client error (4xx), such as an unsupported language. |
|
|
32
|
+
| `text.anonymize-failed` | warning | An anonymize request fails with a client error (4xx). |
|
|
33
|
+
| `text.analyze-errored` | critical | An analyze request fails with a service error. |
|
|
34
|
+
| `text.anonymize-errored` | critical | An anonymize request fails with a service error. |
|
|
35
|
+
|
|
36
|
+
The actor is the caller of the API, typically a service account (identified by its `client_id`), not the person whose text is processed. The resource is a `text-processing-request` identified by the request `correlation_id`, or a generated one if none is supplied. Metadata holds the `language`, `scoreThreshold`, the number of entities detected (`entitiesDetected`), the calling service (`azp` claim) and, for failures, the `errorType`. Client errors are recorded with status `failure` and service errors with status `error`. The submitted text, detected values and replacements are never recorded.
|
|
37
|
+
|
|
38
|
+
The service account of PII service needs the audit service writer role. Set `PII_AUDIT_ENABLED` to `false` to disable recording for this service. When it is unset, the platform-wide `AUDIT_ENABLED` variable applies, and recording is on if neither is set.
|
|
39
|
+
|
|
24
40
|
## Code examples
|
|
25
41
|
### Anonymize text
|
|
26
42
|
```typescript
|
|
@@ -128,20 +128,20 @@ Project planner service records audit events in the `project-planner-service` na
|
|
|
128
128
|
|
|
129
129
|
| action | category | severity | retention class | recorded when |
|
|
130
130
|
|:-|:-|:-|:-|:-|
|
|
131
|
-
|
|
|
132
|
-
|
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
-
|
|
|
139
|
-
|
|
|
140
|
-
|
|
|
131
|
+
| solution.created | administrative | info | compliance | A solution is created (`POST /solutions`), with the `scenario` in the metadata. |
|
|
132
|
+
| solution.deleted | administrative | warning | compliance | A solution is deleted by its owner (`DELETE /solutions/{id}`), with its `scenario` and `status`. |
|
|
133
|
+
| solution.exported | data-access | info | compliance | A solution is downloaded (`GET /solutions/{id}/export`, `scope: 'solution'` with the latest `version` and `unsavedChanges`) or a saved version is downloaded (`GET /solutions/{id}/versions/{number}/export`, `scope: 'version'` with the `version`). |
|
|
134
|
+
| solution.admin-accessed | data-access | info | compliance | A `planner-admin` successfully reads, changes or exports a solution owned by another user, with the `ownerId` and the `operation` (`read`, `update` or `export`) in the metadata. Reading the solution or its versions is `read`; changes, analysis, discovery, chat, consultations, blueprints, component reviews and version checkpoints or renames are `update`. A specialist chat that uses the solution as context is `read`, or `update` when the chat changes the solution. |
|
|
135
|
+
| solution.analyzed | runtime | info | standard | A request sends solution content to the AI model, with the `endpoint` (`analyze`, `discovery`, `chat`, `blueprint`, `consult` or `specialist-chat`), the `mode` of the result (`ai`, or `rules` after a fallback), the configured `model`, whether any model call in the request `fellBack` to rules, and the specialist `service` for consultations and specialist chats. |
|
|
136
|
+
| pattern.created | administrative | info | compliance | A tenant pattern is created (`POST /patterns`), with `source: 'custom'`. |
|
|
137
|
+
| pattern.updated | administrative | info | compliance | A pattern is updated or a built-in pattern is customized (`PUT /patterns/{id}`), with the `source` after the update and the `previousSource`. The change set holds the before and after values of the changed pattern fields. |
|
|
138
|
+
| pattern.deleted | administrative | warning | compliance | A custom pattern is deleted or a customized built-in pattern is reset (`DELETE /patterns/{id}`), with the `source` (`custom` or `customized`) of the deleted pattern. |
|
|
139
|
+
| specialist-chat.exported | data-access | info | compliance | A user downloads one saved specialist chat (`scope: 'single'`) or all of their chats (`scope: 'all'`), with the `chatCount`, the specialist `service` and the `solutionId` (the filters, for an export of all chats). |
|
|
140
|
+
| specialist-chat.deleted | administrative | info | compliance | A saved specialist chat is deleted, with its specialist `service` and `solutionId`. |
|
|
141
141
|
|
|
142
142
|
Solution records use `{ type: 'solution', id: <solution ID>, name: <solution name> }` as the resource, pattern records use `{ type: 'pattern', id: <pattern ID>, name: <pattern name> }`, and chat records use `{ type: 'specialist-chat', id: <chat ID> }`. An export of all chats has no single chat, so it has no resource. A pattern change set that would exceed the 16 KB audit limit is omitted, with `changeSetOmitted: true` in the metadata.
|
|
143
143
|
|
|
144
|
-
`
|
|
144
|
+
`solution.analyzed` is recorded only when the model is called: rule-based requests, and AI requests when no model is configured, send nothing to the model and are not recorded. It is recorded once per request when the request completes, including when the request fails after solution content was sent to the model. A failed request is recorded with status `failure` (client error) or `error` (server error) and without a `mode`, since there is no result.
|
|
145
145
|
|
|
146
146
|
Routine reads by the solution owner (listing and reading solutions, patterns, specialists, chats and versions) are not audited, and neither is a `planner-admin` listing the solutions of the tenant. Solution updates are not recorded as separate actions; they are covered by the `solution-updated` event. Patterns defined in the `patterns` configuration are managed in the [configuration service](configuration-service.md), which records those changes in the `configuration-service` namespace. Denied and failed operations are not recorded.
|
|
147
147
|
|
|
@@ -8,7 +8,7 @@ parent: Services
|
|
|
8
8
|
|
|
9
9
|
## Overview
|
|
10
10
|
|
|
11
|
-
Push service provides a push mode gateway to domain events sent through the [event service](event-service.md). Applications subscribe to a configured stream and receive matching events as they happen, using [socket.io](https://socket.io) or server-sent events, instead of polling.
|
|
11
|
+
Push service provides a push mode gateway to domain events sent through the [event service](event-service.md). Applications subscribe to a configured stream and receive matching events as they happen, using a WebSocket connection through [socket.io](https://socket.io), or server-sent events, instead of polling.
|
|
12
12
|
|
|
13
13
|
The push service also calls tenant configured webhooks when matching domain events occur.
|
|
14
14
|
|
|
@@ -48,9 +48,9 @@ See the [API reference](https://api.adsp.alberta.ca) for request and response de
|
|
|
48
48
|
| :------------------------------------ | :------------------------------------------------- | :------------------------------------------------------------------ |
|
|
49
49
|
| `GET /stream/v1/streams` | List the streams that the caller can subscribe to. | None. The result only includes streams the caller can subscribe to. |
|
|
50
50
|
| `GET /stream/v1/streams/{stream}` | Subscribe to a stream using server-sent events. | `stream-listener` or one of `subscriberRoles`, or a public stream. |
|
|
51
|
-
| socket.io connection (not in OpenAPI) | Subscribe to a stream
|
|
51
|
+
| socket.io connection (not in OpenAPI) | Subscribe to a stream over WebSocket (socket.io). | `stream-listener` or one of `subscriberRoles`, or a public stream. |
|
|
52
52
|
|
|
53
|
-
The socket.io connection is not a REST endpoint, so it isn't in the OpenAPI documentation. It works as follows:
|
|
53
|
+
The socket.io connection is a WebSocket connection, not a REST endpoint, so it isn't in the OpenAPI documentation. It works as follows:
|
|
54
54
|
|
|
55
55
|
- **URL**: `https://push-service.adsp.alberta.ca/<namespace>` with the default socket.io path (`/socket.io`). The namespace is `/` (the default namespace), or a tenant name in kebab case, for example `/my-tenant`.
|
|
56
56
|
- **Stream ID**: the `stream` query parameter of the connection. An optional `criteria` query parameter holds JSON encoded criteria (`correlationId`, `context`) that each event must match.
|
|
@@ -4,3 +4,47 @@ title: Services
|
|
|
4
4
|
nav_order: 4
|
|
5
5
|
has_children: true
|
|
6
6
|
---
|
|
7
|
+
|
|
8
|
+
# Services
|
|
9
|
+
|
|
10
|
+
ADSP platform services are multi-tenant APIs that product teams use instead of building the same capabilities themselves. Each service guide covers the service's client roles, tenancy, API overview, concepts, events and code examples. Request and response schemas for every API are in the [API documentation](https://api.adsp.alberta.ca).
|
|
11
|
+
|
|
12
|
+
Requests to a service are scoped to the tenant of the caller's access token. Platform (core) service accounts can act on behalf of a tenant by passing a `tenantId`. See [Tenant service](tenant-service.md) for how tenants map to realms, and [Directory service](directory-service.md) for how to look up service URLs by URN.
|
|
13
|
+
|
|
14
|
+
## Foundation
|
|
15
|
+
|
|
16
|
+
| Service | Use it to |
|
|
17
|
+
| :------------------------------------------------ | :----------------------------------------------------------------- |
|
|
18
|
+
| [Access service](access-service.md) | Sign users in and manage roles, using a Keycloak realm per tenant. |
|
|
19
|
+
| [Tenant service](tenant-service.md) | Create and look up tenants. |
|
|
20
|
+
| [Directory service](directory-service.md) | Find service and API URLs from logical URNs. |
|
|
21
|
+
| [Configuration service](configuration-service.md) | Store tenant and platform configuration, with revisions. |
|
|
22
|
+
| [Event service](event-service.md) | Send domain events, which are logged and routed to other services. |
|
|
23
|
+
| [Value service](value-service.md) | Store time series values and metrics, including the event log. |
|
|
24
|
+
| [Push service](push-service.md) | Stream domain events to applications over WebSockets or webhooks. |
|
|
25
|
+
|
|
26
|
+
## Application capabilities
|
|
27
|
+
|
|
28
|
+
| Service | Use it to |
|
|
29
|
+
| :---------------------------------------------------- | :------------------------------------------------------------------------------ |
|
|
30
|
+
| [Form service](form-service.md) | Define forms, and let applicants draft and submit them. |
|
|
31
|
+
| [File service](file-service.md) | Upload, scan and download files, with access controlled by file type. |
|
|
32
|
+
| [Notification service](notification-service.md) | Send email, SMS and bot notifications to subscribers when domain events happen. |
|
|
33
|
+
| [Task service](task-service.md) | Queue work and assign it to workers. |
|
|
34
|
+
| [Comment service](comment-service.md) | Add topics and comments to application records. |
|
|
35
|
+
| [Calendar service](calendar-service.md) | Look up dates and holidays, and schedule calendar events. |
|
|
36
|
+
| [PDF service](pdf-service.md) | Generate PDFs from templates. |
|
|
37
|
+
| [Export service](export-service.md) | Export another service's API resources to a file. |
|
|
38
|
+
| [Verify service](verify-service.md) | Generate and check time-limited verification codes. |
|
|
39
|
+
| [Feedback service](feedback-service.md) | Collect user feedback with an embeddable widget. |
|
|
40
|
+
| [Status service](status-service.md) | Monitor application health, publish status and post service notices. |
|
|
41
|
+
| [Audit service](audit-service.md) | Record and search audit records of who did what to which resource. |
|
|
42
|
+
| [PII service](pii-service.md) | Find and anonymize personally identifiable information in text. |
|
|
43
|
+
| [Cache service](cache-service.md) | Cache reads from upstream APIs within the tenant security model. |
|
|
44
|
+
| [Token handler](token-handler.md) | Sign users in to a browser application with a session cookie instead of tokens. |
|
|
45
|
+
| [Agent service](agent-service.md) | Run configurable AI agents with tools and role-based access. |
|
|
46
|
+
| [Project planner service](project-planner-service.md) | Turn a business problem into a plan for using ADSP services. |
|
|
47
|
+
|
|
48
|
+
## Operations
|
|
49
|
+
|
|
50
|
+
- [Access service backup and disaster recovery](access-service-backup-disaster-recovery.md)
|
|
@@ -5,24 +5,180 @@ parent: Services
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Status service
|
|
8
|
+
|
|
8
9
|
Status services provides configuration of applications, operational status of those applications, and allows posting of service notices.
|
|
9
10
|
|
|
10
11
|
## Client roles
|
|
12
|
+
|
|
11
13
|
client `urn:ads:platform:status-service`
|
|
12
14
|
|
|
13
|
-
| name
|
|
14
|
-
|
|
15
|
-
| status-admin | Administrator role for status service.
|
|
15
|
+
| name | description |
|
|
16
|
+
| :----------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| status-admin | Administrator role for status service. It is included in the tenant admin role. The notice endpoints require it to create, update, and delete notices, and to read draft and archived notices. |
|
|
18
|
+
|
|
19
|
+
The application endpoints (`/status/v1`) require an authenticated user of the tenant, but don't check for a specific role. The public status endpoint is anonymous.
|
|
20
|
+
|
|
21
|
+
## Tenancy
|
|
22
|
+
|
|
23
|
+
- **Application and notice management.** Tenant users act on the tenant of their token. These endpoints don't accept a `tenantId` parameter, so a token without a tenant context (a core user) is not supported.
|
|
24
|
+
- **Isolation.** Applications and notices of other tenants respond 404.
|
|
25
|
+
- **Public status.** `GET /public_status/v1/applications/{tenant}` takes the tenant name in the path and doesn't need a token.
|
|
26
|
+
- **Public notices.** Anonymous requests to `GET /notice/v1/notices` read published notices; set the `name` query parameter to a tenant name to read only that tenant's notices. Authenticated users read the notices of the tenant of their token.
|
|
27
|
+
- **Configuration.** Applications are stored in the tenant's `platform:status-service` configuration in the [configuration service](configuration-service.md). The status service uses only the tenant configuration; there are no platform (core) applications.
|
|
28
|
+
|
|
29
|
+
## API overview
|
|
30
|
+
|
|
31
|
+
All endpoints are under `https://status-service.adsp.alberta.ca`. See the [API documentation](https://api.adsp.alberta.ca) for request and response schemas.
|
|
32
|
+
|
|
33
|
+
| Endpoint | Purpose | Required role |
|
|
34
|
+
| :------------------------------------------------------------------- | :---------------------------------------------------- | :---------------------------------------------------- |
|
|
35
|
+
| `GET /status/v1/applications` | List the tenant's applications with their status. | Authenticated tenant user |
|
|
36
|
+
| `POST /status/v1/applications` | Add an application. | Authenticated tenant user |
|
|
37
|
+
| `PUT /status/v1/applications/{appKey}` | Replace an application's configuration. | Authenticated tenant user |
|
|
38
|
+
| `DELETE /status/v1/applications/{appKey}` | Delete an application and its health check results. | Authenticated tenant user |
|
|
39
|
+
| `PATCH /status/v1/applications/{appKey}/enable`, `disable`, `toggle` | Turn health checks on or off. | Authenticated tenant user |
|
|
40
|
+
| `PATCH /status/v1/applications/{appKey}/status` | Set the published status of an application. | Authenticated tenant user |
|
|
41
|
+
| `GET /status/v1/applications/{appKey}/endpoint-status-entries` | Read the health check results of an application. | Authenticated tenant user |
|
|
42
|
+
| `GET /status/v1/applications/endpoint-status-entries` | Read recent health check results. | Authenticated tenant user |
|
|
43
|
+
| `GET /status/v1/webhook/{id}/test/{eventName}` | Send a test event to a monitoring webhook. | Authenticated tenant user |
|
|
44
|
+
| `GET /public_status/v1/applications/{tenant}` | Read the published status of a tenant's applications. | Anonymous |
|
|
45
|
+
| `GET /notice/v1/notices` | List notices. | Anonymous (published), `status-admin` (all) |
|
|
46
|
+
| `GET /notice/v1/notices/{id}` | Read a notice. | Authenticated tenant user (published), `status-admin` |
|
|
47
|
+
| `POST /notice/v1/notices` | Create a draft notice. | `status-admin` |
|
|
48
|
+
| `PATCH /notice/v1/notices/{id}` | Update, publish, or archive a notice. | `status-admin` |
|
|
49
|
+
| `DELETE /notice/v1/notices/{id}` | Delete a draft notice. | `status-admin` |
|
|
50
|
+
|
|
51
|
+
The service contact information and the intervals of [webhooks](/adsp-monorepo/tutorials/status-service/webhooks.html) are managed in the tenant's `platform:status-service` configuration through the configuration service; the status service has no endpoints of its own for them. Monitoring webhooks themselves are configured in the push service.
|
|
16
52
|
|
|
17
53
|
## Concepts
|
|
54
|
+
|
|
18
55
|
### Application
|
|
19
|
-
|
|
56
|
+
|
|
57
|
+
Applications represent digital services that an end user may wish to access. Each application should be meaningful and distinguishable to end users, so that they understand what tasks may be unavailable to the outage of any particular application. Applications with `monitorOnly` set are monitored but not shown on the public status page.
|
|
20
58
|
|
|
21
59
|
### Status
|
|
22
|
-
|
|
60
|
+
|
|
61
|
+
The status of an application indicates whether the service is fully available to end users, may be experiencing disruption, or is in planned or unplanned outage. It is one of `operational`, `reported-issues`, `maintenance`, or `outage`.
|
|
23
62
|
|
|
24
63
|
### Health check
|
|
64
|
+
|
|
25
65
|
Health checks poll against an application endpoint to check for issues. It helps the tenant administrators monitor for issues. By default, health checks do not update the status. If `autoChangeStatus` is set on the application, the status changes from `operational` to `reported-issues` after the health check fails for 5 minutes, and back to `operational` after it succeeds for 5 minutes. Other statuses, such as `maintenance` and `outage`, are only changed manually.
|
|
26
66
|
|
|
67
|
+
The `toggle` endpoint starts or stops health checks immediately. The `enable` and `disable` endpoints change the setting, and health checks pick up the change when the service reloads them, every 5 minutes. Health check results older than 48 hours are deleted nightly.
|
|
68
|
+
|
|
27
69
|
### Notice
|
|
28
|
-
|
|
70
|
+
|
|
71
|
+
Notices are important messages to users regarding upcoming changes to an application. For example, they can be used to inform users of scheduled maintenance events or service disruptions. A notice is created as a `draft`, then `published`, and finally `archived`. Only draft notices can be edited or deleted, and only published notices are shown on the public status page.
|
|
72
|
+
|
|
73
|
+
## Events
|
|
74
|
+
|
|
75
|
+
Status service sends these domain events in the `status-service` namespace:
|
|
76
|
+
|
|
77
|
+
| Event | Sent when |
|
|
78
|
+
| :----------------------------- | :---------------------------------------------------------------------------------------- |
|
|
79
|
+
| `health-check-started` | Health checks of an application are started (toggle). |
|
|
80
|
+
| `health-check-stopped` | Health checks of an application are stopped (toggle, or delete). |
|
|
81
|
+
| `application-healthy` | A health check finds an application online after it was not. |
|
|
82
|
+
| `application-unhealthy` | A health check finds an application offline after it was not. |
|
|
83
|
+
| `application-status-changed` | The published status of an application is changed. |
|
|
84
|
+
| `application-notice-published` | A notice is published. |
|
|
85
|
+
| `monitored-service-down` | An application is down for the interval configured for a webhook, or a webhook is tested. |
|
|
86
|
+
| `monitored-service-up` | An application is back up after being reported down, or a webhook is tested. |
|
|
87
|
+
|
|
88
|
+
The service consumes its own `health-check-started` and `health-check-stopped` events to start and stop health check jobs.
|
|
89
|
+
|
|
90
|
+
It also registers two notification types: `status-application-health-change` (health check started, stopped, healthy, and unhealthy; for `status-admin` subscribers) and `status-application-status-change` (status changed and notice published).
|
|
91
|
+
|
|
92
|
+
## Audit
|
|
93
|
+
Changes made by status administrators are recorded in the [audit service](/adsp-monorepo/services/audit-service.html) under the `status-service` namespace. The actor is the administrator (ID, name and roles, without the email address), not the service account.
|
|
94
|
+
|
|
95
|
+
| Action | Resource | Notes |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| `application.created` / `application.updated` / `application.deleted` | application | |
|
|
98
|
+
| `application.status-changed` | application | Change set holds the previous and new status; each transition is its own record. |
|
|
99
|
+
| `notice.created` / `notice.updated` / `notice.deleted` | notice | Metadata holds the message, dates and mode. |
|
|
100
|
+
| `health-check.configured` | application | Health check URL changed, or monitoring enabled or disabled. |
|
|
101
|
+
|
|
102
|
+
Health check polling results, automatic status changes and public reads are not audited. Set `STATUS_AUDIT_ENABLED` to `false` to disable; when unset it follows the SDK `AUDIT_ENABLED` variable (on by default).
|
|
103
|
+
|
|
104
|
+
## Code examples
|
|
105
|
+
|
|
106
|
+
### Add an application and start health checks
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
const statusServiceUrl = 'https://status-service.adsp.alberta.ca';
|
|
110
|
+
|
|
111
|
+
const response = await fetch(`${statusServiceUrl}/status/v1/applications`, {
|
|
112
|
+
method: 'POST',
|
|
113
|
+
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
|
114
|
+
body: JSON.stringify({
|
|
115
|
+
name: 'My Application',
|
|
116
|
+
description: 'Online application for a benefit program.',
|
|
117
|
+
endpoint: { url: 'https://my-application.alberta.ca/health' },
|
|
118
|
+
}),
|
|
119
|
+
});
|
|
120
|
+
const { appKey } = await response.json();
|
|
121
|
+
|
|
122
|
+
// Toggle turns on health checks for the new application.
|
|
123
|
+
const toggled = await fetch(`${statusServiceUrl}/status/v1/applications/${appKey}/toggle`, {
|
|
124
|
+
method: 'PATCH',
|
|
125
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
126
|
+
});
|
|
127
|
+
const { enabled, internalStatus } = await toggled.json();
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Set the status of an application
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
const response = await fetch(`https://status-service.adsp.alberta.ca/status/v1/applications/${appKey}/status`, {
|
|
134
|
+
method: 'PATCH',
|
|
135
|
+
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
|
136
|
+
body: JSON.stringify({ status: 'maintenance' }),
|
|
137
|
+
});
|
|
138
|
+
const { status, statusTimestamp } = await response.json();
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Read the public status of a tenant's applications
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
const response = await fetch(`https://status-service.adsp.alberta.ca/public_status/v1/applications/${tenantName}`);
|
|
145
|
+
const applications = await response.json();
|
|
146
|
+
for (const { name, status, lastUpdated } of applications) {
|
|
147
|
+
console.log(`${name}: ${status} (updated ${lastUpdated})`);
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Publish a notice
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
const statusServiceUrl = 'https://status-service.adsp.alberta.ca';
|
|
155
|
+
|
|
156
|
+
// Requires the status-admin role.
|
|
157
|
+
const created = await fetch(`${statusServiceUrl}/notice/v1/notices`, {
|
|
158
|
+
method: 'POST',
|
|
159
|
+
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
|
160
|
+
body: JSON.stringify({
|
|
161
|
+
message: 'My Application will be down for weekly maintenance during the following hours.',
|
|
162
|
+
tennantServRef: [{ id: 'my-application', name: 'My Application' }],
|
|
163
|
+
isAllApplications: false,
|
|
164
|
+
startDate: '2026-11-15T02:00:00.000Z',
|
|
165
|
+
endDate: '2026-11-15T04:00:00.000Z',
|
|
166
|
+
}),
|
|
167
|
+
});
|
|
168
|
+
const { id } = await created.json();
|
|
169
|
+
|
|
170
|
+
const published = await fetch(`${statusServiceUrl}/notice/v1/notices/${id}`, {
|
|
171
|
+
method: 'PATCH',
|
|
172
|
+
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
|
173
|
+
body: JSON.stringify({ mode: 'published' }),
|
|
174
|
+
});
|
|
175
|
+
const { mode } = await published.json();
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Read the published notices of a tenant
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
const response = await fetch(`https://status-service.adsp.alberta.ca/notice/v1/notices?name=${tenantName}`);
|
|
182
|
+
const { results, page } = await response.json();
|
|
183
|
+
// page.next is a query string, for example after=50&top=50, or null on the last page.
|
|
184
|
+
```
|