Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 131 additions & 35 deletions resources/assets/js/pages/docs/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,48 +108,116 @@
<section>
<h2 class="steps" id="what-now">{{ $t('documentation.steps.eight.heading') }}</h2>
<p class="u-text-wrap">{{ $t('documentation.steps.eight.body') }}</p>
<p class="u-text-wrap">
The public WhatNow content API has two versions. <strong>V2 is the current API</strong> and exposes published WhatNow content as <strong>Prepare Messages</strong> through the <code>preparemessages</code> resource. <strong>V1 is legacy</strong> and remains available for older integrations that still call the <code>whatnow</code> resource.
</p>

<h3>V2 Prepare Messages API</h3>
<p class="u-text-wrap">
Use V2 for new integrations. V2 returns published preparedness messages grouped by stage. Each populated stage is an array of structured message objects, where <code>title</code> is the key safety message and <code>content</code> is a list of supporting messages.
</p>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Endpoint</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>GET /v2/org/{country_code}</code></td>
<td>Returns the organisation metadata for the supplied country code.</td>
</tr>
<tr>
<td><code>GET /v2/org/{country_code}/preparemessages</code></td>
<td>Returns the published Prepare Messages feed for an organisation.</td>
</tr>
<tr>
<td><code>GET /v2/preparemessages/{id}</code></td>
<td>Returns one published Prepare Messages item by id.</td>
</tr>
</tbody>
</table>
</div>

<p><strong>V2 feed query parameters</strong></p>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>{{ $t('documentation.steps.eight.table.query_params.name') }}</th>
<th>{{ $t('documentation.steps.eight.table.query_params.description') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>eventType</td>
<td>Optional event type filter. Multiple event types may be separated using a comma, e.g., <code>?eventType=earthquake,hurricane</code>.</td>
</tr>
<tr>
<td>language</td>
<td>Optional language filter. Use the ISO language code for the translation to return, e.g., <code>?language=en</code>. If omitted, V2 can also use the <code>Accept-Language</code> header when present.</td>
</tr>
<tr>
<td>subnational</td>
<td>Optional subnational filter. Use the subnational slug configured for the organisation, e.g., <code>?subnational=north-west</code>.</td>
</tr>
</tbody>
</table>
</div>

<p><strong>V2 stage keys</strong></p>
<ul>
<li>immediate</li>
<li>warning</li>
<li>anticipated</li>
<li>assess_and_plan</li>
<li>mitigate_risks</li>
<li>mitigate_risk</li>
<li>prepare_to_respond</li>
<li>recover</li>
</ul>
<p><strong>{{ $t('documentation.steps.eight.endpoint') }}</strong></p>
<b-card class="bg-grey d-inline-block w-auto p-2">
<pre>GET org/{country_code}/whatnow?eventType={eventType}&language={language}&subnational={subnational}</pre>
</b-card>

<!-- Query Parameters Table -->
<p><strong>{{ $t('documentation.steps.eight.query_params') }}</strong></p>
<h3>V1 Legacy WhatNow API</h3>
<p class="u-text-wrap">
V1 is provided for backwards compatibility. Existing clients can continue to call the legacy WhatNow endpoints, but new clients should use V2 Prepare Messages endpoints instead.
</p>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>{{ $t('documentation.steps.eight.table.query_params.name') }}</th>
<th>{{ $t('documentation.steps.eight.table.query_params.description') }}</th>
<th>Endpoint</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>eventType</td>
<td>Optional event type filter. Multiple event types may be separated using a comma, e.g., <code>?eventType=earthquake,hurricane</code></td>
<td><code>GET /v1/org/{country_code}</code></td>
<td>Returns legacy organisation metadata for the supplied country code.</td>
</tr>
<tr>
<td>language</td>
<td>Optional language filter. Specify the language code, e.g., <code>?language=en</code></td>
<td><code>GET /v1/org/{country_code}/whatnow</code></td>
<td>Returns the legacy published WhatNow feed for an organisation. The legacy feed supports <code>eventType</code> filtering.</td>
</tr>
<tr>
<td>subnational</td>
<td>Optional subnational filter. Specify the subnational name, e.g., <code>?subnational=north%20west</code></td>
<td><code>GET /v1/whatnow/{id}</code></td>
<td>Returns one legacy published WhatNow item by id.</td>
</tr>
</tbody>
</table>
</div>


<p><strong>V1 legacy stage keys</strong></p>
<ul>
<li>mitigation</li>
<li>seasonalForecast</li>
<li>watch</li>
<li>warning</li>
<li>immediate</li>
<li>recover</li>
</ul>
<p class="u-text-wrap">
V1 stage content is returned in the legacy stored format. V2 should be used when consumers need the current Prepare Messages structure with explicit <code>title</code> and <code>content</code> fields.
</p>

<!-- Example Response -->
<p><strong>{{ $t('documentation.steps.eight.example_response') }}</strong></p>
Expand Down Expand Up @@ -279,38 +347,66 @@
<tbody>
<tr>
<td>warning</td>
<td>array of strings</td>
<td>Warning preparation steps</td>
<td>array&lt;message object&gt; | null</td>
<td>Messages for warning lead-time actions.</td>
</tr>
<tr>
<td>immediate</td>
<td>array of strings</td>
<td>Immediate preparation steps</td>
<td>array&lt;message object&gt; | null</td>
<td>Messages for actions during an active or imminent hazard.</td>
</tr>
<tr>
<td>recover</td>
<td>array of strings</td>
<td>Recover preparation steps</td>
<td>array&lt;message object&gt; | null</td>
<td>Messages for recovery actions after a hazard event.</td>
</tr>
<tr>
<td>anticipated</td>
<td>array of strings</td>
<td>Anticipated preparation steps</td>
<td>array&lt;message object&gt; | null</td>
<td>Messages for anticipated hazards and early preparedness actions.</td>
</tr>
<tr>
<td>assess_and_plan</td>
<td>array of strings</td>
<td>Assess and Plan preparation steps</td>
<td>array&lt;message object&gt; | null</td>
<td>Messages for assessing risk and planning risk-reduction activities.</td>
</tr>
<tr>
<td>mitigate_risks</td>
<td>array of strings</td>
<td>Mitigate Risks preparation steps</td>
<td>mitigate_risk</td>
<td>array&lt;message object&gt; | null</td>
<td>Messages for longer-term mitigation measures that reduce hazard risk.</td>
</tr>
<tr>
<td>prepare_to_respond</td>
<td>array of strings</td>
<td>Prepare to Respond preparation steps</td>
<td>array&lt;message object&gt; | null</td>
<td>Messages for developing response capacity before a hazard event.</td>
</tr>
</tbody>
</table>
</div>

<p><strong>Structure of a stage message object</strong></p>
<p class="u-text-wrap">
Each V2 stage value is either <code>null</code> when no messages are published for that stage, or an array of message objects. Each message object contains a priority safety message in <code>title</code> and zero or more supporting messages in <code>content</code>.
</p>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>{{ $t('documentation.steps.eight.table.structure.property') }}</th>
<th>{{ $t('documentation.steps.eight.table.structure.data_type') }}</th>
<th>{{ $t('documentation.steps.eight.table.structure.description') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>title</td>
<td>string</td>
<td>The key safety message or priority action for the stage.</td>
</tr>
<tr>
<td>content</td>
<td>array&lt;string&gt;</td>
<td>Supporting messages that add detail to the key safety message. This array may be empty.</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -434,7 +530,7 @@ export default {
"recover": null,
"anticipated": null,
"assess_and_plan": null,
"mitigate_risks": null,
"mitigate_risk": null,
"prepare_to_respond": null
}
}
Expand All @@ -455,7 +551,7 @@ export default {
if (!this.selectedOrganization) {
return ''
}
const url = `${this.apiPrepareCenterUrl}/org/${this.selectedOrganization}/whatnow`
const url = `${this.apiPrepareCenterUrl}/org/${this.selectedOrganization}/preparemessages`
const params = new URLSearchParams()
if (this.selectedEventType) {
params.append('eventType', this.selectedEventType)
Expand Down Expand Up @@ -491,7 +587,7 @@ export default {
this.dataLoaded = false
try {

const orgsResponse = await axios.get(`${this.apiPrepareCenterUrl}/v2/org`, {
const orgsResponse = await axios.get(`${this.apiPrepareCenterUrl}/org`, {
headers: { 'x-api-key': this.apiKey }
})
this.organizations = orgsResponse.data.data
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/am.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@
"anticipated": "በቅድሚያ የተጠበቀ",
"assess_and_plan": "ግምገማ እና እቅድ",
"mitigate_risks": "አደጋን መቀነስ",
"mitigate_risk": "አደጋን መቀነስ",
"prepare_to_respond": "ለመልስ ዝግጁ ይሁኑ",
"recover": "መልሶ ማግኛት"
},
Expand Down Expand Up @@ -539,6 +540,8 @@
"anticipated": "በቅድሚያ የተጠበቀ",
"assess_and_plan": "ግምገማ እና እቅድ",
"mitigate_risks": "አደጋን መቀነስ",
"mitigate_risk_subt": "",
"mitigate_risk_extra": "የተገነቡ እና ተፈጥሯዊ አካባቢዎችን ይበልጥ ደህና ለማድረግ እና ቀደምት የማስጠንቀቂያ ስርዓቶችን ለመመስረት የመቀነሻ እርምጃዎችን ይውሰዱ",
"prepare_to_respond": "ለመልስ ዝግጁ ይሁኑ",
"updated": "የተሻሻለ",
"download_icon": "ምልክቶችን ያውርዱ",
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@
"anticipated": "متوقع",
"assess_and_plan": "تقييم وتخطيط",
"mitigate_risks": "تخفيف المخاطرة",
"mitigate_risk": "تخفيف المخاطرة",
"prepare_to_respond": "الاستعداد للاستجابة",
"recover": "التعافي"
},
Expand Down Expand Up @@ -587,7 +588,9 @@
"assess_and_plan_subt": "",
"assess_and_plan_extra": "تقييم المخاطر وتخطيط الأنشطة للتعرف على أحداث الخطر وتقليلها والاستجابة لها",
"mitigate_risks_subt": "",
"mitigate_risk_subt": "",
"mitigate_risks_extra": "اتخاذ تدابير التخفيف لجعل البيئات المبنية والطبيعية أكثر أمانًا وإنشاء أنظمة إنذار مبكر",
"mitigate_risk_extra": "اتخاذ تدابير التخفيف لجعل البيئات المبنية والطبيعية أكثر أمانًا وإنشاء أنظمة إنذار مبكر",
"key_message_label": "رسالة السلامة",
"supporting_message_label": "رسالة داعمة",
"url_tool": "رابط لمزيد من معلومات رسائل السلامة على موقع جمعيتك الوطنية أو شريكك",
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@
"anticipated": "প্রত্যাশিত",
"assess_and_plan": "মূল্যায়ন এবং পরিকল্পনা",
"mitigate_risks": "ঝুঁকি হ্রাস করুন",
"mitigate_risk": "ঝুঁকি হ্রাস করুন",
"prepare_to_respond": "সাড়া দিতে প্রস্তুত",
"recover": "পুনরুদ্ধার"
},
Expand Down Expand Up @@ -539,6 +540,8 @@
"anticipated": "প্রত্যাশিত",
"assess_and_plan": "মূল্যায়ন এবং পরিকল্পনা",
"mitigate_risks": "ঝুঁকি হ্রাস করুন",
"mitigate_risk_subt": "",
"mitigate_risk_extra": "নির্মিত ও প্রাকৃতিক পরিবেশকে আরও নিরাপদ করতে এবং আগাম সতর্কতা ব্যবস্থা স্থাপন করতে ঝুঁকি প্রশমনমূলক ব্যবস্থা নিন",
"prepare_to_respond": "সাড়া দিতে প্রস্তুত",
"updated": "হালনাগাদকৃত",
"download_icon": "ডাউনলোডের চিহ্ন",
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@
"anticipated": "Erwartet",
"assess_and_plan": "Bewerten und planen",
"mitigate_risks": "Risiko mindern",
"mitigate_risk": "Risiko mindern",
"prepare_to_respond": "Auf die Reaktion vorbereiten",
"recover": "Wiederherstellen"
},
Expand Down Expand Up @@ -539,6 +540,8 @@
"anticipated": "Erwartet",
"assess_and_plan": "Bewerten und planen",
"mitigate_risks": "Risiko mindern",
"mitigate_risk_subt": "",
"mitigate_risk_extra": "Ergreifen Sie Minderungsmaßnahmen, um bebaute und natürliche Umgebungen sicherer zu machen und Frühwarnsysteme einzurichten",
"prepare_to_respond": "Auf die Reaktion vorbereiten",
"updated": "aktualisiert",
"download_icon": "Icon herunterladen",
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
"anticipated": "Anticipated",
"assess_and_plan": "Assess and Plan",
"mitigate_risks": "Mitigate Risk",
"mitigate_risk": "Mitigate Risk",
"prepare_to_respond": "Prepare to Respond",
"recover": "Recover"
},
Expand Down Expand Up @@ -600,7 +601,9 @@
"assess_and_plan_subt": "",
"assess_and_plan_extra": "Assess risks and plan activities to recognize, reduce, and respond to hazard events",
"mitigate_risks_subt": "",
"mitigate_risk_subt": "",
"mitigate_risks_extra": "Take mitigation measures to make the built and natural environments safer and establishing early warning systems",
"mitigate_risk_extra": "Take mitigation measures to make the built and natural environments safer and establishing early warning systems",
"key_message_label": "Safety Message",
"supporting_message_label": "Supporting message",
"url_tool": "Link to more safety message information on your National Society or partner website",
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@
"anticipated": "Anticipado",
"assess_and_plan": "Evaluar y Planificar",
"mitigate_risks": "Mitigar Riesgo",
"mitigate_risk": "Mitigar Riesgo",
"prepare_to_respond": "Prepararse para Responder",
"recover": "Recuperación"
},
Expand Down Expand Up @@ -587,7 +588,9 @@
"assess_and_plan_subt": "",
"assess_and_plan_extra": "Evaluar riesgos y planificar actividades para reconocer, reducir y responder a eventos de peligro",
"mitigate_risks_subt": "",
"mitigate_risk_subt": "",
"mitigate_risks_extra": "Tomar medidas de mitigación para hacer más seguros los entornos construidos y naturales y establecer sistemas de alerta temprana",
"mitigate_risk_extra": "Tomar medidas de mitigación para hacer más seguros los entornos construidos y naturales y establecer sistemas de alerta temprana",
"key_message_label": "Mensaje de Seguridad",
"supporting_message_label": "Mensaje de apoyo",
"url_tool": "Enlace a más información sobre mensajes de seguridad en el sitio web de tu Sociedad Nacional o socio",
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@
"anticipated": "Anticipé",
"assess_and_plan": "Évaluer et Planifier",
"mitigate_risks": "Atténuer le Risque",
"mitigate_risk": "Atténuer le Risque",
"prepare_to_respond": "Se Préparer à Réagir",
"recover": "Rétablissement"
},
Expand Down Expand Up @@ -587,7 +588,9 @@
"assess_and_plan_subt": "",
"assess_and_plan_extra": "Évaluer les risques et planifier les activités pour reconnaître, réduire et répondre aux événements dangereux",
"mitigate_risks_subt": "",
"mitigate_risk_subt": "",
"mitigate_risks_extra": "Prendre des mesures d'atténuation pour rendre les environnements bâtis et naturels plus sûrs et établir des systèmes d'alerte précoce",
"mitigate_risk_extra": "Prendre des mesures d'atténuation pour rendre les environnements bâtis et naturels plus sûrs et établir des systèmes d'alerte précoce",
"key_message_label": "Message de Sécurité",
"supporting_message_label": "Message de soutien",
"url_tool": "Lien vers plus d'informations sur les messages de sécurité sur le site web de votre Société Nationale ou partenaire",
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/ht.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@
"anticipated": "Antisipe",
"assess_and_plan": "Evalye epi Planifye",
"mitigate_risks": "Diminye Risk",
"mitigate_risk": "Diminye Risk",
"prepare_to_respond": "Prepare pou Reponn",
"recover": "Rekipere"
},
Expand Down Expand Up @@ -539,6 +540,8 @@
"anticipated": "Antisipe",
"assess_and_plan": "Evalye epi Planifye",
"mitigate_risks": "Diminye Risk",
"mitigate_risk_subt": "",
"mitigate_risk_extra": "Pran mezi mitigasyon pou rann anviwònman bati ak natirèl yo pi an sekirite epi mete sistèm avètisman bonè an plas",
"prepare_to_respond": "Prepare pou Reponn",
"updated": "Ajou",
"download_icon": "Telechaje ikòn",
Expand Down
Loading
Loading