{
  "openapi": "3.1.0",
  "info": {
    "title": "Forward Networks: Network Collection API",
    "description": "Configure configuration and state collection from network devices",
    "contact": {
      "email": "support@forwardnetworks.com"
    },
    "license": {
      "name": "MIT",
      "url": "https://spdx.org/licenses/MIT"
    },
    "version": "${apiVersion}"
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "security": [
    {
      "api_token": []
    }
  ],
  "tags": [
    {
      "name": "Network Collection",
      "description": "Configure configuration and state collection from network devices"
    }
  ],
  "paths": {
    "/api/networks/{networkId}/cancelcollection": {
      "post": {
        "tags": [
          "Network Collection"
        ],
        "summary": "Cancels an in-progress network collection",
        "operationId": "cancelCollectUsingPOST",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/networks/{networkId}/collection-schedules": {
      "get": {
        "tags": [
          "Network Collection"
        ],
        "summary": "Gets a network’s collection schedules",
        "operationId": "getCollectionSchedulesUsingGET",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionSchedules"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Network Collection"
        ],
        "summary": "Adds a network collection schedule",
        "operationId": "addCollectionScheduleUsingPOST",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionScheduleDefinition"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionSchedule"
                }
              }
            }
          }
        }
      }
    },
    "/api/networks/{networkId}/collection-schedules/{scheduleId}": {
      "get": {
        "tags": [
          "Network Collection"
        ],
        "summary": "Gets a network collection schedule",
        "operationId": "getCollectionScheduleUsingGET",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scheduleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionSchedule"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Network Collection"
        ],
        "summary": "Replaces a network collection schedule",
        "operationId": "replaceCollectionScheduleUsingPUT",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scheduleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectionSchedule"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Network Collection"
        ],
        "summary": "Deletes a network collection schedule",
        "operationId": "deleteCollectionScheduleUsingDELETE",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scheduleId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content",
            "content": {}
          }
        }
      }
    },
    "/api/networks/{networkId}/collector/status": {
      "get": {
        "tags": [
          "Network Collection"
        ],
        "summary": "Gets the status of a network’s collector",
        "operationId": "getCollectorStateUsingGET",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectorState"
                }
              }
            }
          }
        }
      }
    },
    "/api/networks/{networkId}/startcollection": {
      "post": {
        "tags": [
          "Network Collection"
        ],
        "summary": "Triggers a network collection",
        "operationId": "collectUsingPOST",
        "parameters": [
          {
            "name": "networkId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CollectionSchedule": {
        "allOf": [
          {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "Network-specific collection schedule identifier",
                "examples": [
                  "1"
                ]
              }
            }
          },
          {
            "$ref": "#/components/schemas/CollectionScheduleDefinition"
          }
        ]
      },
      "CollectionScheduleDefinition": {
        "type": "object",
        "required": [
          "enabled",
          "daysOfTheWeek"
        ],
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Whether the schedule is currently in effect",
            "examples": [
              true
            ]
          },
          "timeZone": {
            "$ref": "#/components/schemas/TimeZone",
            "description": "The time zone used to identify day boundaries and to interpret `times`, `startAt`, and `endAt`. Defaults to the organization’s preferred time zone.",
            "examples": [
              "America/Los_Angeles"
            ]
          },
          "daysOfTheWeek": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "description": "The days of the week, Sun (0), Mon (1), …, Sat (6), on which the collection schedule is active. Never empty.",
            "examples": [
              "- 0\n- 2\n- 4\n- 6"
            ]
          },
          "times": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Times of the day (in \"HH:mm\" format) at which network collections should start. Either `times` or `periodInSeconds` must be specified—not both. Never empty if present.",
            "examples": [
              "- '01:00'\n- '06:00'\n- '11:00'\n- '16:00'\n- '21:00'"
            ]
          },
          "periodInSeconds": {
            "type": "integer",
            "format": "int32",
            "description": "How many seconds after the start of the most recent collection that the next one should begin. Either `times` or `periodInSeconds` must be specified—not both. Must be positive.\n\n**Note**: A Collector can only perform one network collection at a time. A scheduled collection will be delayed if it cannot start on time due to an earlier collection running long.",
            "examples": [
              1800
            ]
          },
          "startAt": {
            "type": "string",
            "description": "The time of day (in \"HH:mm\" format) at which a rate-based collection schedule begins. Must be absent if `times` is specified. Defaults to the start of the day (00:00).",
            "examples": [
              "05:30"
            ]
          },
          "endAt": {
            "type": "string",
            "description": "The time of day (in \"HH:mm\" format) at which a rate-based collection schedule ends. Must be absent if `times` is specified. Defaults to the end of the day.",
            "examples": [
              "20:00"
            ]
          }
        }
      },
      "CollectionSchedules": {
        "type": "object",
        "properties": {
          "schedules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CollectionSchedule"
            }
          }
        }
      },
      "CollectorState": {
        "type": "object",
        "required": [
          "isSet"
        ],
        "properties": {
          "isSet": {
            "type": "boolean",
            "description": "Whether the network has a Collector assigned"
          },
          "busyStatus": {
            "$ref": "#/components/schemas/CollectorStatus",
            "description": "Absent if the network has no Collector assigned"
          }
        }
      },
      "CollectorStatus": {
        "type": "string",
        "enum": [
          "OFFLINE",
          "IDLE",
          "TESTING",
          "COLLECTING",
          "COLLECTION_QUEUED",
          "DISCOVERING",
          "UPDATING"
        ]
      },
      "TimeZone": {
        "type": "string",
        "enum": [
          "UTC",
          "Africa/Accra",
          "Africa/Addis_Ababa",
          "Africa/Algiers",
          "Africa/Cairo",
          "Africa/Dar_es_Salaam",
          "Africa/Johannesburg",
          "Africa/Khartoum",
          "Africa/Kinshasa",
          "Africa/Lagos",
          "Africa/Luanda",
          "Africa/Maputo",
          "America/Argentina/Buenos_Aires",
          "America/Bogota",
          "America/Chicago",
          "America/Denver",
          "America/Lima",
          "America/Los_Angeles",
          "America/Mexico_City",
          "America/New_York",
          "America/Phoenix",
          "America/Santiago",
          "America/Sao_Paulo",
          "America/Toronto",
          "Asia/Amman",
          "Asia/Baghdad",
          "Asia/Bangkok",
          "Asia/Beirut",
          "Asia/Dhaka",
          "Asia/Ho_Chi_Minh",
          "Asia/Hong_Kong",
          "Asia/Jakarta",
          "Asia/Jerusalem",
          "Asia/Karachi",
          "Asia/Kolkata",
          "Asia/Kuala_Lumpur",
          "Asia/Manila",
          "Asia/Riyadh",
          "Asia/Seoul",
          "Asia/Shanghai",
          "Asia/Singapore",
          "Asia/Tehran",
          "Asia/Tokyo",
          "Asia/Yangon",
          "Australia/Adelaide",
          "Australia/Eucla",
          "Australia/Perth",
          "Australia/Sydney",
          "Europe/Belgrade",
          "Europe/Berlin",
          "Europe/Istanbul",
          "Europe/London",
          "Europe/Madrid",
          "Europe/Moscow",
          "Europe/Paris",
          "Europe/Rome"
        ]
      }
    },
    "securitySchemes": {
      "api_token": {
        "type": "http",
        "scheme": "basic"
      }
    }
  }
}