swagger: "2.0"
schemes:
  - https
host: api.mercedes-benz.com
basePath: /dealer_tryout/v1
info:
  contact:
    name: The open API platform by Mercedes-Benz
    x-twitter: MercedesBenz
  description: The Dealer API provides Dealer search functions.
  title: Dealer
  version: "1.0"
  x-apisguru-categories:
    - transport
  x-logo:
    url: https://twitter.com/MercedesBenz/profile_image?size=original
  x-origin:
    - format: swagger
      url: https://developer.mercedes-benz.com/content/sites/default/files/2018-07/swagger_dealer_api_0.yaml
      version: "2.0"
  x-providerName: mercedes-benz.com
  x-serviceName: dealer
produces:
  - application/json
parameters:
  activity:
    description: |-
      Filter by activity, valid actitvity values are:
        * PARTS: Spare Parts Sales
        * SALES: Sales of new vehicles
        * SERVICE: Maintaining and repair
        * USED-VEHICLES-TRADE: Sales of used vehicles
    enum:
      - PARTS
      - SALES
      - SERVICE
      - USED-VEHICLES-TRADE
    in: query
    name: activity
    required: false
    type: string
  brand:
    description: |-
      Filter by brand, valid values are:
        * MB: Mercedes-Benz
        * SMT: Smart
    enum:
      - MB
      - SMT
    in: query
    name: brand
    required: false
    type: string
  city:
    description: The city of the dealer address.
    in: query
    name: city
    required: false
    type: string
  countryIsoCode:
    description: The country of the dealer address defined as ISO two letter ID (e.g. DE, CH, CN, etc.)
    in: query
    name: countryIsoCode
    required: false
    type: string
  dealerId:
    default: GS0000275
    description: The dealer id is dealer’s business key, also known as GS Id. e.g. GS0000857
    in: path
    name: dealerId
    required: true
    type: string
  dealerIds:
    description: |
      Array of dealer ids. The dealer id is dealer’s business key, also known as GS Id. e.g. GS0000857,GS0017621
    in: query
    items:
      type: string
    name: dealerIds
    required: false
    type: array
  fieldsForDealer:
    description: Specifies which fields should be included in the result. If this filter is not used, per default all fields are returned. e.g. fields=dealerId,address(street,city)
    in: query
    name: fields
    required: false
    type: string
  fieldsForDealers:
    description: Specifies which fields should be included in the result. If this filter is not used, per default all fields are returned. e.g. fields=dealers(dealerId,address(street,city))
    in: query
    name: fields
    required: false
    type: string
  latitude:
    description: The latitude geo coordinate.
    in: query
    name: latitude
    required: false
    type: number
  legalName:
    description: A name of the dealer, the name filter will be applied to all Dealer names (e.g. legalName, nameAddition). You can also search for parts of Dealer names, e.g. the search term 'Niederlassung' will also match 'Niederlassung Stuttgart'.
    in: query
    name: name
    required: false
    type: string
  longitude:
    description: The longitude geo coordinate.
    in: query
    name: longitude
    required: false
    type: number
  page:
    description: |
      The index of the page to be returned. If this parameter is omitted, the first page will be returned.
    format: int32
    in: query
    name: page
    required: false
    type: integer
  pageSize:
    description: |
      The index of the page to be returned. If this parameter is omitted, the first page will be returned.
    format: int32
    in: query
    name: pageSize
    required: false
    type: integer
  productGroup:
    description: Filter by a product group
    enum:
      - PASSENGER-CAR
      - VAN
    in: query
    name: productGroup
    required: false
    type: string
  radiusUnit:
    default: KM
    description: The radius unit of the search area. The center of the search area is defined by geo coordinates. (latitude, longitude properties) If radiusValue and radiusUnit parameters are missing, then the default radius is 10 km.
    enum:
      - M
      - KM
      - MILE
    in: query
    name: radiusUnit
    required: false
    type: string
  radiusValue:
    default: 10
    description: The radius value of the search area. The center of the search area is defined by geo coordinates. (latitude, longitude properties) If radiusValue and radiusUnit parameters are missing, then the default radius is 10 km.
    in: query
    name: radiusValue
    required: false
    type: integer
tags:
  - description: Resources that provide search functions for dealers (dealer, garage, retailer, etc.) based on given attributes.
    name: Dealer search
  - description: Reference data that is required for the Dealer API.
    name: References
paths:
  /countries:
    get:
      description: This request returns the countries supported by the Dealer API
      operationId: countriesGET
      parameters:
        - $ref: "#/parameters/page"
        - $ref: "#/parameters/pageSize"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/HalifiedCountries"
        "400":
          description: |-
            Invalid parameter was specified:
             * Page is not valid
             * Page size is not valid
        "401":
          description: |-
            Unauthorized:
              * Failed to resolve API Key query parameter
              * Invalid API Key
        "429":
          description: Quota limit is exceeded
        "500":
          description: Internal server error
      tags:
        - References
    x-swagger-router-controller: get_countries
  /dealers:
    get:
      description: This request returns dealers (dealer, garage, retailer, etc.) for given parameters
      operationId: dealersGET
      parameters:
        - $ref: "#/parameters/dealerIds"
        - $ref: "#/parameters/latitude"
        - $ref: "#/parameters/longitude"
        - $ref: "#/parameters/radiusValue"
        - $ref: "#/parameters/radiusUnit"
        - $ref: "#/parameters/countryIsoCode"
        - $ref: "#/parameters/city"
        - $ref: "#/parameters/legalName"
        - $ref: "#/parameters/brand"
        - $ref: "#/parameters/productGroup"
        - $ref: "#/parameters/activity"
        - $ref: "#/parameters/fieldsForDealers"
        - $ref: "#/parameters/page"
        - $ref: "#/parameters/pageSize"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/HalifiedDealers"
        "204":
          description: The search did not match any dealers.
        "400":
          description: |-
            Invalid parameter was specified:
             * DealerId is not valid
             * Area search is not valid (latitude or longitude missing or invalid)
             * Country ISO code is not valid
             * Brand code is not valid
             * Product group is not valid
             * Activity is not valid
             * Page is not valid
             * Page size is not valid
        "401":
          description: |-
            Unauthorized:
              * Failed to resolve API Key query parameter
              * Invalid API Key
        "429":
          description: Quota limit is exceeded
        "500":
          description: Internal server error
      tags:
        - Dealer search
    x-swagger-router-controller: get_dealers
  "/dealers/{dealerId}":
    get:
      description: This request returns dealers for given parameters
      operationId: dealerGET
      parameters:
        - $ref: "#/parameters/dealerId"
        - $ref: "#/parameters/fieldsForDealer"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/Dealer"
        "400":
          description: Invalid format for parameter dealerId was specified
        "401":
          description: |-
            Unauthorized:
              * Failed to resolve API Key query parameter
              * Invalid API Key
        "404":
          description: Dealer not found
        "429":
          description: Quota limit is exceeded
        "500":
          description: Internal server error
      tags:
        - Dealer search
    x-swagger-router-controller: get_dealer_by_id
definitions:
  ActivityOfAFunction:
    properties:
      code:
        description: |-
          The activity of the dealer, valid actitvity values are:
            * PARTS: Spare Parts Sales
            * SALES: Sales of new vehicles
            * SERVICE: Maintaining and repair
            * USED-VEHICLES-TRADE: Sales of used vehicles
        type: string
      name:
        description: the corresponding activity name
        type: string
    required:
      - code
      - name
    type: object
  Address:
    properties:
      addressAddition:
        description: address addition
        type: string
      city:
        description: city
        type: string
      countryIsoCode:
        description: ISO A2 country code
        type: string
      district:
        description: district, area of city
        type: string
      street:
        description: street and house number, if applicable
        type: string
      zipCode:
        description: postal code
        type: string
    type: object
  Brand:
    properties:
      code:
        description: brand qualifier
        type: string
      name:
        description: brand name
        type: string
    required:
      - code
      - name
    type: object
  BrandCode:
    properties:
      brand:
        $ref: "#/definitions/Brand"
    required:
      - brand
    type: object
  CommunicationChannels:
    properties:
      general:
        $ref: "#/definitions/General"
    type: object
  Country:
    properties:
      countryId:
        description: the country id
        type: string
      isoCode:
        description: the country iso code
        type: string
      name:
        description: the country name
        type: string
    required:
      - countryId
      - isoCode
      - name
    type: object
  Dealer:
    description: the representation of an dealer
    properties:
      _links:
        $ref: "#/definitions/SelfLink"
      address:
        $ref: "#/definitions/Address"
      brandCodes:
        description: network brand codes of the dealer, dealer numbers
        items:
          $ref: "#/definitions/BrandCode"
        type: array
      communication:
        $ref: "#/definitions/CommunicationChannels"
      dealerId:
        description: GSSN unique ID, main identifier
        type: string
      distance:
        $ref: "#/definitions/TheDistance"
      functions:
        description: list of functions for the dealer
        items:
          $ref: "#/definitions/Function"
        type: array
        uniqueItems: true
      geoCoordinates:
        $ref: "#/definitions/GeoCoordinates"
      legalName:
        description: legal name of the company
        type: string
      nameAddition:
        description: name addition, country specific use
        type: string
      openingHours:
        description: |
          List of opening hours for each customer relevant function for
          each day
        items:
          $ref: "#/definitions/FunctionOpeningHours"
        type: array
        uniqueItems: true
      region:
        $ref: "#/definitions/RegionRepresentation"
    required:
      - _links
      - legalName
      - dealerId
    type: object
  DefaultLinks:
    description: default links
    properties:
      next:
        $ref: "#/definitions/Link"
      previous:
        $ref: "#/definitions/Link"
      self:
        $ref: "#/definitions/Link"
    type: object
  Function:
    properties:
      activity:
        $ref: "#/definitions/ActivityOfAFunction"
      brand:
        $ref: "#/definitions/Brand"
      productGroup:
        $ref: "#/definitions/ProductGroupOfAFunction"
    required:
      - activity
      - brand
      - productGroup
    type: object
  FunctionOpeningHours:
    properties:
      function:
        $ref: "#/definitions/Function"
      weekdays:
        $ref: "#/definitions/Weekdays"
    type: object
  General:
    properties:
      email:
        description: general email address
        type: string
      facebook:
        description: general facebook URL
        type: string
      fax:
        description: general fax number
        type: string
      googlePlus:
        description: general googlePlus account name
        type: string
      mobile:
        description: general mobile phone number
        type: string
      phone:
        description: general phone number
        type: string
      twitter:
        description: general twitter account name
        type: string
      website:
        description: general website
        type: string
    type: object
  GeoCoordinates:
    properties:
      latitude:
        description: latitude - in decimal degrees
        format: double
        type: number
      longitude:
        description: longitude - in decimal degrees
        format: double
        type: number
    required:
      - latitude
      - longitude
    type: object
  HalifiedCountries:
    description: countries and navigation links for additional results.
    properties:
      _links:
        $ref: "#/definitions/DefaultLinks"
      countries:
        description: countries
        items:
          $ref: "#/definitions/Country"
        type: array
    required:
      - _links
    type: object
  HalifiedDealers:
    description: dealer with navigation links.
    properties:
      _links:
        $ref: "#/definitions/DefaultLinks"
      dealers:
        description: dealers
        items:
          $ref: "#/definitions/Dealer"
        type: array
    required:
      - _links
    type: object
  Link:
    description: the representation of a link
    properties:
      href:
        description: the target of the link
        type: string
    required:
      - href
    type: object
  Periods:
    properties:
      from:
        description: from
        type: string
      until:
        description: until
        type: string
    required:
      - from
      - until
    type: object
  ProductGroupOfAFunction:
    properties:
      code:
        description: |-
          The product group code, valid values are:
            * PASSENGER-CAR
            * VAN
        type: string
      name:
        description: product group name
        type: string
    required:
      - code
      - name
    type: object
  RegionRepresentation:
    properties:
      region:
        description: region
        type: string
      subRegion:
        description: subregion
        type: string
    type: object
  SelfLink:
    description: self links
    properties:
      self:
        $ref: "#/definitions/Link"
    type: object
  TheDistance:
    properties:
      unit:
        description: unit of length
        enum:
          - M
          - KM
          - MILE
        type: string
      value:
        description: numeric amount of distance
        format: double
        type: number
    required:
      - value
    type: object
  WeekdayInfo:
    properties:
      periods:
        description: time periods
        items:
          $ref: "#/definitions/Periods"
        type: array
      status:
        description: status (OPEN or CLOSED)
        enum:
          - OPEN
          - CLOSED
        type: string
    type: object
  Weekdays:
    description: |
      opening hours for a week, represented by a map where the key
      is a weekday and the value is an object containing the time periods. There
      are a maximum of two time slots for each day. If there exists no opening
      hours for one day, they will be shown as closed.
    properties:
      FRIDAY:
        $ref: "#/definitions/WeekdayInfo"
      MONDAY:
        $ref: "#/definitions/WeekdayInfo"
      SATURDAY:
        $ref: "#/definitions/WeekdayInfo"
      SUNDAY:
        $ref: "#/definitions/WeekdayInfo"
      THURSDAY:
        $ref: "#/definitions/WeekdayInfo"
      TUESDAY:
        $ref: "#/definitions/WeekdayInfo"
      WEDNESDAY:
        $ref: "#/definitions/WeekdayInfo"
    type: object
x-default-apikey: Tyt82ndiKG0AdH8TCqe001ROh7RsGOKB
