openapi: 3.0.0
info:
  description: >-
    API provided to customers worldwide to get a snapshot of Michelin stock
    (qty) at country level
  version: 1.2.0
  title: EDIWHEEL STOCK REPORT
  contact:
    name: API Support
    email: devportal.support@michelin.com
    url: 'https://indus.developer.michelin.com/en/contact'
servers:
  - url: 'https://indus.api.michelin.com/'
    description: Indus
  - url: 'https://sandbox.api.michelin.com/'
    description: Sandbox
security:
  - BasicAuth: []
tags:
  - name: Stock Report EDIWheel B2
    description: Help the dealer get visibility on item availability with the supplier
paths:
  # Name of the resource to append to the basepath
  /stock/C1_0/report:
    get:
      summary: GET stock-report in JSON
      operationId: stockreportGETC10POST
      description: Get stock report
      parameters:
        - $ref: '#/components/parameters/BuyerParty'
        - $ref: '#/components/parameters/AgencyCode'
        - $ref: '#/components/parameters/Apikey'
      responses:
        # HTTP status code
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StockReport'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProxyErrorResponse'
              example: |-
                {
                    "fault": {
                        "faultstring": "Invalid ApiKey",
                        "detail": {
                            "errorcode": "oauth.v2.InvalidApiKey"
                        }
                    }
                }
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProxyErrorResponse'
              example: |-
                {
                  "code": "500",
                  "message": "Internal server error occured"
                }
        '503':
          description: Service unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProxyErrorResponse'
              example: |-
                {
                   "fault": {
                      "faultstring": "The Service is temporarily unavailable", 
                      "detail": {
                           "errorcode": "messaging.adaptors.http.flow.ServiceUnavailable"
                       }
                    }
                }
        '504':
          description: >-
            Gateway timeout. A response was not available to send within the
            stipulated time limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProxyErrorResponse'
              example: |-
                {
                    "fault": {
                        "faultstring": "Gateway Timeout",
                        "detail": {
                            "errorcode": "messaging.adaptors.http.flow.GatewayTimeout"
                        }
                    }
                }
components:
  parameters: 
    Apikey:
      name: apikey
      in: header
      schema:
        type: string
      required: true
      description: API key is a code used to identify and authenticate an application or user.
    BuyerParty:
      name: buyerParty
      in: query
      description: Identifier of the customer for which the stockr report is requested
      required: true
      schema:
        type: string
      example: 30012456
    AgencyCode:
      name: agencyCode
      in: query
      description: Code identifying the agency responsible for an identifier
      required: true
      schema:
        $ref: '#/components/schemas/agencyCode'
  schemas:
    ProxyErrorResponse:
      type: object
      properties:
        fault:
          type: object
          properties:
            faultstring:
              type: string
            detail:
              type: object
              properties:
                errorcode:
                  type: string
    agencyCode:
      type: string
      enum:
        - '91'
        - '92'
        - '9'
      xml:
        name: AgencyCode
      description: |
        Applicable Codes:
          * `91` - Assigned by seller or seller's agent
          * `92` - Assigned by buyer or buyer's agent
          * `9`  - EAN (International Article Numbering Association)
    BuyerParty:
      type: object
      properties:
        partyId:
          type: string
          maxLength: 17
        agencyCode:
          $ref: '#/components/schemas/agencyCode'
      required:
        - partyId
        - agencyCode
      xml:
        name: BuyerParty
    StockReport:
      type: object
      properties:
        envelopeHeader:
          type: object
          properties:
            issueDate:
              type: string
              xml:
                name: IssueDate
            issueTime:
              type: string
            documentId:
              type: string
            variant:
              type: string
            errorCode:
              type: string
        totalLineItemsNumber:
          type: integer
        buyerParty:
          $ref: '#/components/schemas/BuyerParty'
        lineLevel:
          type: array
          items:
            $ref: '#/components/schemas/Line'
    Line:
      type: object
      properties:
        lineId:
          type: string
        article:
          $ref: '#/components/schemas/Article'
    Article:
      type: object
      properties:
        articleIdentification:
          $ref: '#/components/schemas/ArticleIdentification'
        articleDescription:
          $ref: '#/components/schemas/ArticleDescription'
        availableQuantity:
          $ref: '#/components/schemas/AvailableQuantity'
    ArticleDescription:
      type: object
      properties:
        articleDescriptionText:
          type: string
    ArticleIdentification:
      type: object
      properties:
        buyersArticleId:
          type: string
        manufacturersArticleId:
          type: string
        eanuccarticleID:
          type: string
    AvailableQuantity:
      type: object
      properties:
        quantityValue:
          type: string
  securitySchemes:
    BasicAuth:
      scheme: basic
      type: http
