
import { Diagram } from "../../src/Diagram";

# API flow diagram

## Core Weather API flow diagram

This diagram shows the workflow to get a location key, then to use that location key to request forecasts, current conditions, indices, and alarms.

<Diagram
  fitView={[
    'start',
    'geo-search',
    'text-postal',
    'text-city',
    'get-location-key',
    'forecast-api',
    'current-conditions-api',
    'indices-api',
    'alarms-api',
  ]}
  initialNodes={[
    {
      id: "start",
      type: "input",
      data: {
        label:
          "Use the Locations API to find the location key for your location."
      },
      position: { x: 0, y: 0 },
    },
    {
      id: "geo-search",
      data: {
        label: "Geoposition search",
        link:
          "/core-weather/geoposition-locations#location-search-by-geoposition",

      },
      position: { x: 0, y: 0 },
    },
    {
      id: "text-postal",
      data: {
        label: "Text search using postal code",
        link: "/core-weather/text-search#postal-code-search",
      },
      position: { x: 0, y: 0 },
    },
    {
      id: "text-city",
      data: {
        label: "Text search using city name",
        link: "/core-weather/text-search#city-search",
      },
      position: { x: 0, y: 0 },
    },
    {
      id: "get-location-key",
      data: { label: "Get location key from API response" },
      position: { x: 0, y: 0 },
    },
    {
      id: "forecast-api",
      data: { label: "Forecast API",
      link: "/core-weather/location-key-daily",
       },
      position: { x: 0, y: 0 },
    },
    {
      id: "current-conditions-api",
      data: { label: "Current Conditions API",
              link: "/core-weather/location-key-currentconditions",
              },
      position: { x: 0, y: 0 },
    },
    {
      id: "indices-api",
      data: { label: "Indices API", link: "/core-weather/1-day", },
      position: { x: 0, y: 0 },
    },
    {
      id: "alarms-api",
      data: { label: "Weather Alarms API", link: "/core-weather/location-key-alarms", },
      position: { x: 0, y: 0 },
    },

]}
initialEdges={[
{ id: "e12", source: "start", target: "geo-search", type: "smoothstep" },
{ id: "e13", source: "start", target: "text-postal", type: "smoothstep" },
{ id: "e14", source: "start", target: "text-city", type: "smoothstep" },
{
id: "geo-search-to-get-location-key",
source: "geo-search",
target: "get-location-key",
type: "smoothstep",
},
{
id: "text-postal-to-get-location-key",
source: "text-postal",
target: "get-location-key",
type: "smoothstep",
},
{
id: "text-city-to-get-location-key",
source: "text-city",
target: "get-location-key",
type: "smoothstep",
},
{
id: "get-location-key-to-forecast-api",
source: "get-location-key",
target: "forecast-api",
type: "smoothstep",
},
{
id: "get-location-key-to-current-conditions-api",
source: "get-location-key",
target: "current-conditions-api",
type: "smoothstep",
},
{
id: "get-location-key-to-indices-api",
source: "get-location-key",
target: "indices-api",
type: "smoothstep",
},
{
id: "get-location-key-to-alarms-api",
source: "get-location-key",
target: "alarms-api",
type: "smoothstep",
},

]}
/>

## MinuteCast API flow diagram

The MinuteCast™ API provides minute-by-minute precipitation forecasts for a specified location. Unlike the other APIs, it does not require a location key. Forecasts are requested directly using latitude and longitude coordinates.

<Diagram
  fitView={['start', 'minutecast']}
  initialNodes={[
    {
      id: "start",
      type: "input",
      data: {
        label:
          "Use latitude and longitude values rounded to three decimal places",
        result:
          "Lat: 40.790°N\nLon: 77.860°W",
      },
      position: { x: 0, y: 0 },
    },
    {
      id: "minutecast",
      data: {
        label: "MinuteCast API", 
        link: "/minutecast/geoposition-minutecast#1-minute-forecasts-by-latitude-and-longitude",
        result:
          "/forecasts/vl/minute?q=40.790,-77.860",

      },
      position: { x: 0, y: 0 },
    },

]}
initialEdges={[
{ id: "e1", source: "start", target: "minutecast", type: "smoothstep" },

]}
/>
