...
Your endpoint URL will be displayed in the Notification Endpoints listing. Copy the URL and use it in your Requests:
...
Example: Sending CAP XML to a Notification Endpoint using CURL
Curl is a command line tool that allows sending HTTP requests. We will use Curl to demonstrate sending CAP XML to a notification endpoint.
Step 1: Create Notification Endpoint
Follow the steps at the top of this article to create a notification endpoint. Save the “Endpoint URL”.
Step 2: Download and install Curl
The Curl command line tool can be downloaded from https://curl.haxx.se/download.html
Step 3: Obtain CAP XML and Save to File
For demonstration purposes, we will use the same “Severe Thunderstorm” CAP XML provided on the CAP 1.2 Specifications page. Save the XML below to a file named “CAPAlert.xml”:
Code Block |
---|
<?xml version = "1.0" encoding = "UTF-8"?>
<alert xmlns = "urn:oasis:names:tc:emergency:cap:1.2">
<identifier>KSTO1055887203</identifier>
<sender>KSTO@NWS.NOAA.GOV</sender>
<sent>2003-06-17T14:57:00-07:00</sent>
<status>Actual</status>
<msgType>Alert</msgType>
<scope>Public</scope>
<info>
<category>Met</category>
<event>SEVERE THUNDERSTORM</event>
<responseType>Shelter</responseType>
<urgency>Immediate</urgency>
<severity>Severe</severity>
<certainty>Observed</certainty>
<eventCode>
<valueName>SAME</valueName>
<value>SVR</value>
</eventCode>
<expires>2003-06-17T16:00:00-07:00</expires>
<senderName>NATIONAL WEATHER SERVICE SACRAMENTO CA</senderName>
<headline>SEVERE THUNDERSTORM WARNING</headline>
<description> AT 254 PM PDT...NATIONAL WEATHER SERVICE DOPPLER RADAR INDICATED A SEVERE THUNDERSTORM OVER SOUTH CENTRAL ALPINE COUNTY...OR ABOUT 18 MILES SOUTHEAST OF KIRKWOOD...MOVING SOUTHWEST AT 5 MPH. HAIL...INTENSE RAIN AND STRONG DAMAGING WINDS ARE LIKELY WITH THIS STORM.</description>
<instruction>TAKE COVER IN A SUBSTANTIAL SHELTER UNTIL THE STORM PASSES.</instruction>
<contact>BARUFFALDI/JUSKIE</contact>
<area>
<areaDesc>EXTREME NORTH CENTRAL TUOLUMNE COUNTY IN CALIFORNIA, EXTREME NORTHEASTERN CALAVERAS COUNTY IN CALIFORNIA, SOUTHWESTERN ALPINE COUNTY IN CALIFORNIA</areaDesc>
<polygon>38.47,-120.14 38.34,-119.95 38.52,-119.74 38.62,-119.89 38.47,-120.14</polygon>
<geocode>
<valueName>SAME</valueName>
<value>006109</value>
</geocode>
<geocode>
<valueName>SAME</valueName>
<value>006009</value>
</geocode>
<geocode>
<valueName>SAME</valueName>
<value>006003</value>
</geocode>
</area>
</info>
</alert> |
Step 4: Run the Curl Command
Next, we will run the Curl command to send the XML to the Notification Endpoint. Adjust the command below with your XML file path, username and password (if defined on the Endpoint), and Endpoint URL:
Code Block |
---|
curl -X POST -d @CAPAlert.xml -u [Username]:[Password] [Endpoint URL] |
If successful, Curl should show the following:
Code Block |
---|
Message Sent |
Step 5: Check Inbound Notification History
You can verify whether the message was sent successfully by accessing the “Notification Endpoint History” to view a log of all inbound notifications:
...
Step 6: View Inbound Notification Details
Details of each inbound notification are logged and available to view. From the Notification Endpoint History page, locate the appropriate notification and choose the “Details” button:
...
You will then see the details of the inbound notification, including any error message. This information is helpful when performing initial setup:
...
Step 7: Tracking
Inbound notifications are sent just like regular notifications, and they generate the same tracking data. You can quickly jump to the tracking data by clicking the “Tracking” button on the “Notification Endpoint History” page:
...
Refer to the Tracking documentation for detailed information about accessing tracking reports.