swagger: '2.0'
info:
  title: ORFEUS Data Center RRSM Webservice
  description: This is the API documentation of the ODCWS RRSM service in which strong motion parameters available from the RRSM can be downloaded. This API is not stable.
  version: 1.0.0-alpha
host: rdsa.knmi.nl
basePath: /odcws/rrsm/1/
schemes:
  - http
paths:
  /peak-motion:
    get:
      description: >-
        Returns strong motion peak parameters in JSON format that match a search criteria
      tags:
        - RRSM
        - parameters
        - peak-motion
      produces:
        - application/json
      summary: Build a GET request
      parameters:
        - in: query
          name: eventid
          type: string
          description: Event identifier(s)
        - in: query
          name: stationsquareselection
          type: string
          description: Area for stations. Comma delimited minimum latitude, maximum latitude, minimum longitude, maximum longitude (e.g. -90,90,-180,180).
        - in: query
          name: eventsquareselection
          type: string
          description: Area for events. Comma delimited minimum latitude, maximum latitude, minimum longitude, maximum longitude (e.g. -90,90,-180,180).
        - in: query
          name: starttime
          type: string
          format: date-time
          description: Start time of the event (ISO8601).
        - in: query
          name: endtime
          type: string
          format: date-time
          description: End time of the event (ISO8601).
        - in: query
          name: network
          type: string
          description: Network code(s) (supports wildcards, comma delimited list).
        - in: query
          name: station
          type: string
          description: Station code(s) (supports wildcards, comma delimited list).
        - in: query
          name: instrument
          type: string
          description: Instrument code of the sensors (use BH, HH).
        - in: query
          name: minmagnitude
          type: number
          description: Minimum magnitude of the event.
        - in: query
          name: minpga
          type: number
          description: Minimum PGA to return in cm/s^2.
        - in: query
          name: maxpga
          type: number
          description: Maximum PGA to return in cm/s^2.
        - in: query
          name: minpgv
          type: number
          description: Minimum PGV to return in cm/s.
        - in: query
          name: maxpgv
          type: number
          description: Maximum PGV to return in cm/s.
        - in: query
          name: level
          type: string
          default: channel
          description: Level of detail of strong motion parameters.
          enum:
            - channel
            - spectra
      responses:
        '200':
          description: >-
            The request was succesful and has returned the data in a JSON file.
          schema:
            type: "array"
            items:
              $ref: "#/definitions/PeakMotionJSON"
        '204':
          description: The request returns no content.
        '400':
          description: The request was bad, check the filled in parameters.
        '414':
          description: >-
            Request-URL Too Long: The request-URL is longer than the server is
            willing to interpret.
        '500':
          description: >-
            Internal Server Error: The server encountered an unexpected
            condition which prevented it from fulfilling the request.
        '503':
          description: >-
            Service Unavailable: The server is currently unable to handle the
            request due to a temporary overloading or maintenance of the server.
  /shakemap:
    get:
      description: >-
        Returns strong motion parameters in ShakeMap Input XML format for an event id
      tags:
        - RRSM
        - shakemap
      produces:
        - application/xml
      summary: Build a GET request
      parameters:
        - in: query
          name: eventid
          type: string
          required: true
          description: Event identifier.
        - in: query
          name: type
          type: string
          default: event_dat
          description: Type of Shakemap XML input file (strong motion parameters or event parameters).
          enum:
            - event
            - event_dat
      responses:
        '200':
          description: >-
            The request was succesfull and has returned the data in a XML
            file.
          schema:
            type: file
        '204':
          description: The request returns no content.
        '400':
          description: The request was bad, check the filled in parameters.
        '414':
          description: >-
            Request-URL Too Long: The request-URL is longer than the server is
            willing to interpret.
        '500':
          description: >-
            Internal Server Error: The server encountered an unexpected
            condition which prevented it from fulfilling the request.
        '503':
          description: >-
            Service Unavailable: The server is currently unable to handle the
            request due to a temporary overloading or maintenance of the server.
  /version:
    get:
      tags:
        - RRSM
        - version
      produces:
        - text/plain
      summary: Request the service version
      responses:
        '200':
          description: Returns the application version.
          schema:
            type: string
  /application.wadl:
    get:
      tags:
        - RRSM
        - API
      produces:
        - application/xml
      summary: The application documentation in a .wadl file.
      responses:
        '200':
          description: >-
            The documentation of the RRSM webservice will be returned in
            a .wadl format.
          schema:
            type: file
  /application.yaml:
    get:
      tags:
        - RRSM
        - API
      produces:
        - application/x-yaml
      summary: The application documentation in a .yaml file.
      responses:
        '200':
          description: >-
            The documentation of the RRSM webservice will be returned in
            a .yaml format.
          schema:
            type: file

# Output JSON definitions
definitions:
  
  SpectralAmplitudeJSON:
    type: "object"
    required:
      - "period"
      - "amplitude"
      - "type"
    properties:
      period:
        description: "Period in seconds"
        type: "number"
      amplitude:
        description: "Amplitude of spectral ordinate in cm/s^2 (psa) or cm (sd)"
        type: "number"
      type:
        enum: ["sd", "psa"]
        type: "string"

  SensorChannelJSON:
    type: "object"
    required:
      - "channel-code"
      - "pga-value"
      - "pgv-value"
      - "sensor-azimuth"
      - "sensor-dip"
      - "sensor-depth"
      - "low-cut-corner"
      - "high-cut-corner"
    properties:
      spectral-amplitudes:
        description: "Array of spectral amplitudes at given periods when level=spectra is chosen"
        type: "array"
        items:
          $ref: "#/definitions/SpectralAmplitudeJSON"
      channel-code:
        description: "SEED channel code"
        type: "string"
      pga-value:
        description: "Peak ground acceleration in cm/s^2"
        type: "number"
      pgv-value:
        description: "Peak ground velocity in cm/s"
        type: "number"
      sensor-azimuth:
        description: "Sensor azimuth in degrees"
        type: "number"
      sensor-dip:
        description: "Sensor dip in degrees"
        type: "number"
      sensor-depth:
        description: "Sensor depth in meters"
        type: "number"
      low-cut-corner:
        description: "Low cut corner frequency in Hz"
        type: "number"
      high-cut-corner:
        description: "High cut corner frequency in Hz"
        type: "number"

  PeakMotionJSON:
    type: "object"
    required:
    - "event-id"
    - "event-time"
    - "event-magnitude"
    - "magnitude-type"
    - "event-depth"
    - "event-latitude"
    - "event-longitude"
    - "network-code"
    - "station-code"
    - "location-code"
    - "station-latitude"
    - "station-longitude"
    - "station-elevation"
    - "epicentral-distance"
    - "event-location-reference"
    - "event-magnitude-reference"
    - "review-type"
    - "sensor-channels"
    properties:
      sensor-channels:
        type: "array"
        description: "Array of sensor channels and peak motion values"
        items:
          $ref: "#/definitions/SensorChannelJSON"
      event-id:
        description: "Unique event identifier"
        type: "string"
      event-time:
        description: "ISO8601 time of event"
        type: "string"
      event-magnitude:
        description: "Magnitude of event"
        type: "number"
      magnitude-type:
        description: "Magnitude type of event"
        enum: ["mw", "ml", "ms", "mb", "md"]
        type: "string"
      event-depth:
        description: "Depth of the event in km"
        type: "number"
      event-latitude:
        description: "Latitude of the event in degrees"
        minimum: -90
        maximum: 90
        type: "number"
      event-longitude:
        minimum: -180
        maximum: 180
        description: "Longitude of the event in degrees"
        type: "number"
      network-code:
        description: "SEED network identifier"
        type: "string"
      station-code:
        description: "SEED station identifier"
        type: "string"
      location-code:
        description: "SEED location identifier"
        type: "string"
      station-latitude:
        description: "Latitude of station in degrees"
        type: "number"
        minimum: -90
        maximum: 90
      station-longitude:
        description: "Longitude of station in degrees"
        type: "number"
        minimum: -180
        maximum: 180
      station-elevation:
        description: "Elevation of station in meters"
        type: "number"
      epicentral-distance:
        description: "Epicentral distance in kilometers"
        type: "number"
      event-location-reference:
        description: "Reference for event location"
        type: "string"
      event-magnitude-reference:
        description: "Reference for event magnitude"
        type: "string"
      review-type:
        type: "string"
        description: "Manual or automatic processing of event data"
        enum: ["automatic", "manual"]
