gfw-api/fires-summary-stats

View on GitHub
microservice/swagger.json

Summary

Maintainability
Test Coverage
{
  "swagger": "1.0",
  "info": {
    "title": "Fires Analysis Microservice",
    "description": "Microservice for analyzing Fires within polygons and admin boundaries",
    "version": "1.0.0"
  },
  "host": "production-api.globalforestwatch.org",
  "schemes": [
    "https",
    "http"
  ],
  "basePath": "/api/v2",
  "produces": [
    "application/vnd.api+json"
  ],
  "paths": {
    "/fire-alerts/summary-stats/{polyname}/{iso_code}": {
      "get": {
        "description": "Retrieves total number of Fire alerts for a polyname and country",
        "operationId": "getFiresByPolyAndISO",
        "produces": [
          "application/vnd.api+json"
        ],
        "tags": [
          "Fires"
        ],
        "parameters": [
          {
            "name": "polyname",
            "in": "path",
            "description": "polyname",
            "required": true,
            "type": "string"
          },
          {
            "name": "iso_code",
            "in": "path",
            "description": "ISO code",
            "required": true,
            "type": "string"
          },
          {
            "name": "period",
            "in": "query",
            "description": "Time period in format\n```YYYY-MM-DD,YYYY-MM-DD``` (if not specified, returns count for entire date range)",
            "required": false,
            "type": "string"
          },
          {
            "name": "fire_type",
            "in": "query",
            "description": "Filter for VIIRS or MODIS fires\n (if not specified, returns count for both fire types)",
            "required": false,
            "type": "string"
          },
          {
            "name": "aggregate_values",
            "in": "query",
            "description": "aggregate values by date",
            "required": false,
            "type": "boolean"
          },
          {
            "name": "aggregate_by",
            "in": "query",
            "description": "aggregate values by date type or admin\n```[day, week, month, year, quarter, adm1, adm2]```",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Alerts obtained successfully",
            "schema": {
              "$ref": "#/definitions/FireSummaryAPI"
            }
          },
          "404": {
            "description": "endpoint not found",
            "schema": {
              "$ref": "#/definitions/Errors"
            }
          },
          "400": {
            "description": "parameter not set correctly",
            "schema": {
              "$ref": "#/definitions/Errors"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Errors"
            }
          }
        }
      }
    },
    "/fire-alerts/summary-stats/{polyname}/{iso_code}/{adm1_code}": {
      "get": {
        "description": "Retrieves total number of Fire alerts for a polyname, country, and state boundary",
        "operationId": "getFiresByPolyAndISOAndADM1",
        "produces": [
          "application/vnd.api+json"
        ],
        "tags": [
          "Fires"
        ],
        "parameters": [
          {
            "name": "polyname",
            "in": "path",
            "description": "polyname",
            "required": true,
            "type": "string"
          },
          {
            "name": "iso_code",
            "in": "path",
            "description": "ISO code",
            "required": true,
            "type": "string"
          },
          {
            "name": "adm1_code",
            "in": "path",
            "description": "Admin level 1 code",
            "required": true,
            "type": "string"
          },
          {
            "name": "period",
            "in": "query",
            "description": "Time period in format\n```YYYY-MM-DD,YYYY-MM-DD``` (if not specified, returns count for entire date range)",
            "required": false,
            "type": "string"
          },
          {
            "name": "fire_type",
            "in": "query",
            "description": "Filter for VIIRS or MODIS fires\n (if not specified, returns count for both fire types)",
            "required": false,
            "type": "string"
          },
          {
            "name": "aggregate_values",
            "in": "query",
            "description": "aggregate values by date",
            "required": false,
            "type": "boolean"
          },
          {
            "name": "aggregate_by",
            "in": "query",
            "description": "aggregate values by date type or admin\n```[day, week, month, year, quarter, adm1, adm2]```",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Alerts obtained successfully",
            "schema": {
              "$ref": "#/definitions/FireSummaryAPI"
            }
          },
          "404": {
            "description": "endpoint not found",
            "schema": {
              "$ref": "#/definitions/Errors"
            }
          },
          "400": {
            "description": "parameter not set correctly",
            "schema": {
              "$ref": "#/definitions/Errors"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Errors"
            }
          }
        }
      }
    },
    "/fire-alerts/summary-stats/{polyname}/{iso_code}/{adm1_code}/{adm2_code}": {
      "get": {
        "description": "Retrieves total number of Fire alerts for a polyname, country, state and district",
        "operationId": "getFiresByPolyAndISOAndADM1AndADM2",
        "produces": [
          "application/vnd.api+json"
        ],
        "tags": [
          "Fires"
        ],
        "parameters": [
          {
            "name": "polyname",
            "in": "path",
            "description": "polyname",
            "required": true,
            "type": "string"
          },
          {
            "name": "iso_code",
            "in": "path",
            "description": "ISO code",
            "required": true,
            "type": "string"
          },
          {
            "name": "adm1_code",
            "in": "path",
            "description": "Admin level 1 code",
            "required": true,
            "type": "string"
          },
          {
            "name": "adm2_code",
            "in": "path",
            "description": "Admin level 2 code",
            "required": true,
            "type": "string"
          },
          {
            "name": "period",
            "in": "query",
            "description": "Time period in format\n```YYYY-MM-DD,YYYY-MM-DD``` (if not specified, returns count for entire date range)",
            "required": false,
            "type": "string"
          },
          {
            "name": "fire_type",
            "in": "query",
            "description": "Filter for VIIRS or MODIS fires\n (if not specified, returns count for both fire types)",
            "required": false,
            "type": "string"
          },
          {
            "name": "aggregate_values",
            "in": "query",
            "description": "aggregate values by date",
            "required": false,
            "type": "boolean"
          },
          {
            "name": "aggregate_by",
            "in": "query",
            "description": "aggregate values by date type or admin\n```[day, week, month, year, quarter, adm1, adm2]```",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Alerts obtained successfully",
            "schema": {
              "$ref": "#/definitions/FireSummaryAPI"
            }
          },
          "404": {
            "description": "endpoint not found",
            "schema": {
              "$ref": "#/definitions/Errors"
            }
          },
          "400": {
            "description": "parameter not set correctly",
            "schema": {
              "$ref": "#/definitions/Errors"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Errors"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "Errors": {
      "type": "object",
      "description": "Errors",
      "properties": {
        "errors": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Error"
          }
        }
      }
    },
    "Error": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "format": "int32",
          "description": "A unique identifier for this particular occurrence of the problem."
        },
        "links": {
          "type": "object",
          "description": "A links object",
          "properties": {
            "about": {
              "type": "string",
              "description": "A link that leads to further details about this particular occurrence of the problem."
            }
          }
        },
        "status": {
          "type": "string",
          "description": "The HTTP status code applicable to this problem, expressed as a string value"
        },
        "code": {
          "type": "string",
          "description": "An application-specific error code, expressed as a string value"
        },
        "title": {
          "type": "string",
          "description": "A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization."
        },
        "detail": {
          "type": "string",
          "description": "A human-readable explanation specific to this occurrence of the problem. Like title, this field's value can be localized"
        },
        "source": {
          "type": "object",
          "description": "An object containing references to the source of the error, optionally including any of the following members",
          "properties": {
            "pointer": {
              "type": "string",
              "description": "A JSON Pointer [RFC6901] to the associated entity in the request document"
            },
            "parameter": {
              "type": "string",
              "description": "A string indicating which URI query parameter caused the error."
            }
          }
        },
        "meta": {
          "type": "object",
          "description": "A meta object containing non-standard meta-information about the error."
        }
      }
    },
    "FireSummaryAPI": {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Result"
          }
        }
      }
    },
    "Result": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "Dataset Name"
        },
        "id": {
          "type": "string",
          "description": "Dataset ID"
        },
        "fire_type": {
          "type": "string",
          "description": "fire_type (MODIS, VIIRS)"
        },
        "aggregate_values": {
          "type": "string",
          "description": "aggregate values true"
        },
        "aggregate_by": {
          "type": "string",
          "description": "aggregation type (day, week, etc...)"
        },
        "attributes": {
          "properties": {
            "schema": {
              "$ref": "#/definitions/Data"
            }
          }
        }
      }
    },
    "Data": {
      "type": "object",
      "properties": {
        "alerts": {
          "type": "string",
          "description": "Total alerts"
        },
        "value": {
          "type": "integer",
          "description": "total count of fires for requested area"
        }
      }
    },
    "DateCalls": {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/DateResult"
          }
        }
      }
    },
    "DateResult": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "Dataset Name"
        },
        "id": {
          "type": "string",
          "description": "Dataset ID"
        },
        "attributes": {
          "properties": {
            "schema": {
              "$ref": "#/definitions/DateData"
            }
          }
        }
      }
    },
    "DateData": {
      "type": "object",
      "properties": {
        "maxDate": {
          "type": "string",
          "description": "Max date in dataset"
        },
        "minDate": {
          "type": "integer",
          "description": "Min date in dataset"
        }
      }
    }
  }
}