Notamify API
Notamify API v1
Notamify API v1
  • Welcome
  • Basics
    • Quick start
    • Authentication guide
    • Notamify API Credits
  • NOTAM and Briefing endpoints
    • Code Samples for the Notamify API
Powered by GitBook
On this page
  • 1. Fetching NOTAMs with /api/get-notams
  • 2. Generating Briefings with /api/get-briefing
  • Where to Go From Here
  1. NOTAM and Briefing endpoints

Code Samples for the Notamify API

Integrating the Notamify API into your aviation software stack is straightforward, thanks to our ready-to-use code snippets. Below, we’ll walk through Python and JavaScript examples demonstrating how to fetch and interpret NOTAMs, as well as generate role-specific briefings.


1. Fetching NOTAMs with /api/get-notams

Python Example

import requests

api_key = 'YOUR_API_KEY'
url = 'https://api.notamify.com/api/get-notams'

params = {
    'locations': 'KJFK,KLAX',
    'start_date': '2025-01-13',
    'end_date': '2025-01-14'
}

headers = {
    'X-API-Key': api_key
}

try:
    response = requests.get(url, params=params, headers=headers)
    response.raise_for_status()
    notams = response.json()
    print(f"Retrieved {len(notams)} NOTAMs")

    # Process or store the NOTAM data as needed
    # for notam in notams:
    #     print(notam)

except requests.exceptions.RequestException as e:
    print(f"Error fetching NOTAMs: {e}")
  1. API Key: Replace YOUR_API_KEY with your actual Notamify API key.

  2. Parameters: In this example, we’re requesting NOTAMs for two airports (KJFK and KLAX) over a specified date range.

  3. Error Handling: We catch exceptions to handle network issues or invalid requests gracefully.

Javascript Example

// Note: Requires Node.js environment with 'node-fetch' or a similar library installed
import fetch from 'node-fetch';

const apiKey = 'YOUR_API_KEY';
const url = 'https://api.notamify.com/api/get-notams';

const params = new URLSearchParams({
  locations: 'KJFK,KLAX',
  start_date: '2025-01-13',
  end_date: '2025-01-14'
});

const getNOTAMs = async () => {
  try {
    const response = await fetch(`${url}?${params}`, {
      headers: {
        'X-API-Key': apiKey
      }
    });

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }

    const notams = await response.json();
    console.log(`Retrieved ${notams.length} NOTAMs`);

    // Further processing of NOTAM data can be added here
  } catch (error) {
    console.error('Error fetching NOTAMs:', error);
  }
};

getNOTAMs();

2. Generating Briefings with /api/get-briefing

Python Example

import requests

api_key = 'YOUR_API_KEY'
url = 'https://api.notamify.com/api/get-briefing'

params = {
    'locations': 'KJFK,KLAX',
    'start_date': '2025-01-13',
    'end_date': '2025-01-14',
    'role': 'pilot',
    'detailed_briefing': True,
    'markdown': True
}

headers = {
    'X-API-Key': api_key
}

try:
    response = requests.get(url, params=params, headers=headers)
    response.raise_for_status()
    briefing = response.text
    print("Briefing received successfully")
    
    # Example usage
    # print(briefing)

except requests.exceptions.RequestException as e:
    print(f"Error fetching briefing: {e}")

Javascript Example

import fetch from 'node-fetch';

const apiKey = 'YOUR_API_KEY';
const url = 'https://api.notamify.com/api/get-briefing';

const params = new URLSearchParams({
  locations: 'KJFK,KLAX',
  start_date: '2025-01-13',
  end_date: '2025-01-14',
  role: 'pilot',
  detailed_briefing: true,
  markdown: true
});

const getBriefing = async () => {
  try {
    const response = await fetch(`${url}?${params}`, {
      headers: {
        'X-API-Key': apiKey
      }
    });

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }

    const briefing = await response.text();
    console.log('Briefing received successfully');
    // console.log(briefing); // Uncomment to print the briefing

  } catch (error) {
    console.error('Error fetching briefing:', error);
  }
};

getBriefing();

Key Points:

  1. Role-Specific: The role parameter tailors the briefing for pilots, controllers, or dispatchers.

  2. Detailed vs. Condensed: Set detailed_briefing to False if you want a shorter summary.

  3. Markdown: Optionally receive content in Markdown format for easy rendering in various applications.

Where to Go From Here

  • Try Enterprise Endpoints: If you require expanded capabilities such as mapping data (/api/notam-map-data) or detailed NOTAM analysis (/api/notam-details), reach out to Sales for Enterprise access.

PreviousNOTAM and Briefing endpoints

Last updated 3 months ago

Explore our for parameter details and other advanced functionalities.

Complete endpoint document