gfw-api/glad-analysis-tiled

View on GitHub
microservice/public-swagger.json

Summary

Maintainability
Test Coverage
{
  "swagger": "1.0",
  "info": {
    "title": "GLAD and Terra I Analysis Microservice",
    "description": "Microservice for analyzing GLAD and Terra I within selected geometries",
    "version": "1.0.0"
  },
  "host": "production-api.globalforestwatch.org",
  "schemes": [
    "https",
    "http"
  ],
  "basePath": "/api/v2",
  "produces": [
    "application/vnd.api+json"
  ],
  "paths": {
    "/glad-alerts": {
      "get": {
        "description": "Retrieves total number of GLAD alerts for your custom geometry and time period",
        "operationId": "getGladByGeostore",
        "produces": [
          "application/vnd.api+json"
        ],
        "tags": [
          "GLAD"
        ],
        "parameters": [
          {
            "name": "geostore",
            "in": "query",
            "description": "A unique hash assigned to a geographic area\n```3203370361b3d2d087d282507a1746a1```",
            "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": "gladConfirmOnly",
            "in": "query",
            "description": "Filter for confirmed alerts only\n```&gladConfirmOnly=true```",
            "required": false,
            "type": "string"
          },
          {
            "name": "aggregate_values",
            "in": "query",
            "description": "aggregate values by date, defaults to julian_day aggregation",
            "required": false,
            "type": "boolean"
          },
          {
            "name": "aggregate_by",
            "in": "query",
            "description": "aggregate values by date type\n```[day, week, month, year, quarter]```",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Alerts obtained successfully",
            "schema": {
              "$ref": "#/definitions/GladandTerraIAPI"
            }
          },
          "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"
            }
          }
        }
      },
      "post": {
        "description": "Retrieves total number of GLAD alerts for a GeoJson",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/vnd.api+json"
        ],
        "tags": [
          "GLAD"
        ],
        "operationId": "GladGeojson",
        "parameters": [
          {
            "name": "GeoJson",
            "in": "body",
            "description": "A GeoJson polygon feature",
            "required": true,
            "schema": {
              "$ref": "#/definitions/GeoJsonBodyRequest"
            }
          },
          {
            "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": "gladConfirmOnly",
            "in": "query",
            "description": "Filter for confirmed alerts only\n```&gladConfirmOnly=true```",
            "required": false,
            "type": "string"
          },
          {
            "name": "aggregate_values",
            "in": "query",
            "description": "aggregate values by date, defaults to julian_day aggregation",
            "required": false,
            "type": "boolean"
          },
          {
            "name": "aggregate_by",
            "in": "query",
            "description": "aggregate values by date type\n```[day, week, month, year, quarter]```",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Alerts obtained successfully",
            "schema": {
              "$ref": "#/definitions/GladandTerraIAPI"
            }
          },
          "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"
            }
          }
        }
      }
    },
    "/glad-alerts/admin/{country_iso}": {
      "get": {
        "description": "Retrieves total number of GLAD alerts for a country within a time period of interest",
        "operationId": "getGladByCountry",
        "produces": [
          "application/vnd.api+json"
        ],
        "tags": [
          "GLAD"
        ],
        "parameters": [
          {
            "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": "country_iso",
            "in": "path",
            "description": "A Country's 3-letter ISO code\n```BRA```",
            "required": true,
            "type": "string"
          },
          {
            "name": "gladConfirmOnly",
            "in": "query",
            "description": "Filter for confirmed alerts only\n```&gladConfirmOnly=true```",
            "required": false,
            "type": "string"
          },
          {
            "name": "aggregate_values",
            "in": "query",
            "description": "aggregate values by date, defaults to julian_day aggregation",
            "required": false,
            "type": "boolean"
          },
          {
            "name": "aggregate_by",
            "in": "query",
            "description": "aggregate values by date type\n```[day, week, month, year, quarter]```",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Alerts obtained successfully",
            "schema": {
              "$ref": "#/definitions/GladandTerraIAPI"
            }
          },
          "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"
            }
          }
        }
      }
    },
    "/glad-alerts/admin/{country_iso}/{admin_id}": {
      "get": {
        "description": "Retrieves total number of GLAD alerts for GADM level 2 in a country within a time period of interest",
        "operationId": "getGladByAdmin",
        "produces": [
          "application/vnd.api+json"
        ],
        "tags": [
          "GLAD"
        ],
        "parameters": [
          {
            "name": "country_iso",
            "in": "path",
            "description": "A Country's 3-letter ISO code\n```BRA```",
            "required": true,
            "type": "string"
          },
          {
            "name": "admin_id",
            "in": "path",
            "description": "Admin 1 region code based on GADM 2\n```2```",
            "required": true,
            "type": "integer"
          },
          {
            "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": "gladConfirmOnly",
            "in": "query",
            "description": "Filter for confirmed alerts only\n```&gladConfirmOnly=true```",
            "required": false,
            "type": "string"
          },
          {
            "name": "aggregate_values",
            "in": "query",
            "description": "aggregate values by date, defaults to julian_day aggregation",
            "required": false,
            "type": "boolean"
          },
          {
            "name": "aggregate_by",
            "in": "query",
            "description": "aggregate values by date type\n```[day, week, month, year, quarter]```",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Alerts obtained successfully",
            "schema": {
              "$ref": "#/definitions/GladandTerraIAPI"
            }
          },
          "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"
            }
          }
        }
      }
    },
    "/glad-alerts/admin/{country_iso}/{admin_id}/{dist_id}": {
      "get": {
        "description": "Retrieves total number of GLAD alerts for GADM level 3 in a country within a time period of interest",
        "operationId": "getGladByDist",
        "produces": [
          "application/vnd.api+json"
        ],
        "tags": [
          "GLAD"
        ],
        "parameters": [
          {
            "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": "country_iso",
            "in": "path",
            "description": "A Country's 3-letter ISO code\n```BRA```",
            "required": true,
            "type": "string"
          },
          {
            "name": "admin_id",
            "in": "path",
            "description": "Admin 1 region code based on GADM 2\n```2```",
            "required": true,
            "type": "integer"
          },
          {
            "name": "dist_id",
            "in": "path",
            "description": "Admin 2 region code based on GADM 2\n```2```",
            "required": true,
            "type": "integer"
          },
          {
            "name": "gladConfirmOnly",
            "in": "query",
            "description": "Filter for confirmed alerts only\n```&gladConfirmOnly=true```",
            "required": false,
            "type": "string"
          },
          {
            "name": "aggregate_values",
            "in": "query",
            "description": "aggregate values by date, defaults to julian_day aggregation",
            "required": false,
            "type": "boolean"
          },
          {
            "name": "aggregate_by",
            "in": "query",
            "description": "aggregate values by date type\n```[day, week, month, year, quarter]```",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Alerts obtained successfully",
            "schema": {
              "$ref": "#/definitions/GladandTerraIAPI"
            }
          },
          "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"
            }
          }
        }
      }
    },
    "/glad-alerts/use/{use_type}/{use_id}": {
      "get": {
        "description": "Retrieves total number of GLAD alerts for a GFW land use feature within a time period of interest",
        "operationId": "getGladByUse",
        "produces": [
          "application/vnd.api+json"
        ],
        "tags": [
          "GLAD"
        ],
        "parameters": [
          {
            "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": true,
            "type": "string"
          },
          {
            "name": "use_type",
            "in": "path",
            "description": "Land use dataset, one of\n```(logging, oilpalm, mining, fiber)```",
            "required": true,
            "type": "string"
          },
          {
            "name": "use_id",
            "in": "path",
            "description": "Numeric id for a feature within a land use dataset\n````100```",
            "required": true,
            "type": "integer"
          },
          {
            "name": "gladConfirmOnly",
            "in": "query",
            "description": "Filter for confirmed alerts only\n```&gladConfirmOnly=true```",
            "required": false,
            "type": "string"
          },
          {
            "name": "aggregate_values",
            "in": "query",
            "description": "aggregate values by date, defaults to julian_day aggregation",
            "required": false,
            "type": "boolean"
          },
          {
            "name": "aggregate_by",
            "in": "query",
            "description": "aggregate values by date type\n```[day, week, month, year, quarter]```",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Alerts obtained successfully",
            "schema": {
              "$ref": "#/definitions/GladandTerraIAPI"
            }
          },
          "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"
            }
          }
        }
      }
    },
    "/glad-alerts/wdpa/{wdpa_id}": {
      "get": {
        "description": "Retrieves total number of GLAD alerts for a protected area within the WDPA database within a time period of interest",
        "operationId": "getGladByWdpa",
        "produces": [
          "application/vnd.api+json"
        ],
        "tags": [
          "GLAD"
        ],
        "parameters": [
          {
            "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": "wdpa_id",
            "in": "path",
            "description": "The numeric ID for a feature within the WDPA dataset\n```56670``",
            "required": true,
            "type": "integer"
          },
          {
            "name": "gladConfirmOnly",
            "in": "query",
            "description": "Filter for confirmed alerts only\n```&gladConfirmOnly=true```",
            "required": false,
            "type": "string"
          },
          {
            "name": "aggregate_values",
            "in": "query",
            "description": "aggregate values by date, defaults to julian_day aggregation",
            "required": false,
            "type": "boolean"
          },
          {
            "name": "aggregate_by",
            "in": "query",
            "description": "aggregate values by date type\n```[day, week, month, year, quarter]```",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Alerts obtained successfully",
            "schema": {
              "$ref": "#/definitions/GladandTerraIAPI"
            }
          },
          "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"
            }
          }
        }
      }
    },
    "/glad-alerts/date-range": {
      "get": {
        "description": "Retrieves min and max date for the GLAD Alerts database",
        "operationId": "getGladDate",
        "produces": [
          "application/vnd.api+json"
        ],
        "tags": [
          "GLAD"
        ],
        "responses": {
          "200": {
            "description": "Dates obtained successfully",
            "schema": {
              "$ref": "#/definitions/DateCalls"
            }
          },
          "404": {
            "description": "endpoint not found",
            "schema": {
              "$ref": "#/definitions/Errors"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Errors"
            }
          }
        }
      }
    },
    "/glad-alerts/latest": {
      "get": {
        "description": "Retrieves latest (or max) date of GLAD",
        "operationId": "getGladDate",
        "produces": [
          "application/vnd.api+json"
        ],
        "tags": [
          "GLAD"
        ],
        "responses": {
          "200": {
            "description": "Dates obtained successfully",
            "schema": {
              "$ref": "#/definitions/LatestCalls"
            }
          },
          "404": {
            "description": "endpoint not found",
            "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."
        }
      }
    },
    "GladandTerraIAPI": {
      "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"
        },
        "aggregate_values": {
          "type": "string",
          "description": "aggregate values true"
        },
        "aggregate_by": {
          "type": "string",
          "description": "aggregation type (day, week, etc...)"
        },
        "geostore": {
          "type": "string",
          "description": "geostore ID"
        },
        "attributes": {
          "properties": {
            "schema": {
              "$ref": "#/definitions/Data"
            }
          }
        }
      }
    },
    "Data": {
      "type": "object",
      "properties": {
        "areaHA": {
          "type": "string",
          "description": "Total area in hectares"
        },
        "value": {
          "type": "integer",
          "description": "total count of alerts for requested area"
        },
        "downloadUrls": {
          "type": "object",
          "properties": {
            "csv": {
              "type": "string",
              "description": "download link to access data as csv"
            },
            "json": {
              "type": "string",
              "description": "download link to access data as json"
            }
          }
        }
      }
    },
    "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"
        }
      }
    },
    "LatestCalls": {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/LatestResult"
          }
        }
      }
    },
    "LatestResult": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "Dataset Name"
        },
        "id": {
          "type": "string",
          "description": "Dataset ID"
        },
        "attributes": {
          "properties": {
            "schema": {
              "$ref": "#/definitions/LatestData"
            }
          }
        }
      }
    },
    "LatestData": {
      "type": "object",
      "properties": {
        "date": {
          "type": "string",
          "description": "Latest (or Max) date in dataset"
        }
      }
    },
    "GeoJsonBodyRequest": {
      "type": "string"
    }
  }
}