openapi: 3.0.0
info:
  title: Article API - Apigee
  description: >-
    Article API documentation <h2>Authentication & Authorization</h2> <p>You
    will need to be identified before calling any endpoints. </p> <p>In order to
    be recognized and authorized to access our Sale API, we put in place 2
    mechanisms:</p><ul><li>Authentication mechanism is done with a client id
    dedicated to you. <br/>Remember that the client id provided should be shared
    with care.<br/> The client id must be inserted in the header of the request
    in the appropriate field</li><li>Authorization mechanism is done by a
    well-known authorization flow for REST Web API: <strong>Basic auth
    flow.</strong></li></ul>
  license:
    name: Internal usage only
  version: 1.0.0
servers:
  - url: https://indus.api.euromaster.com
    description: APIGEE UAT
  - url: https://api.euromaster.com
    description: APIGEE PROD
tags:
  - name: Article
    description: Article operation with all operation types
paths:
  /article-erm/v1/articles:
    summary: Article endpoints
    get:
      summary: Get article data
      description: Get articles data filtered by parameters
      operationId: getArticles
      tags:
        - Articles
      parameters:
        - in: query
          name: pageNumber
          schema:
            $ref: '#/components/schemas/PageNumberParam'
          required: true
          description: The page number
        - in: query
          name: pageSize
          schema:
            $ref: '#/components/schemas/PageSizeParam'
          required: true
          description: The page size
        - in: query
          name: lastModifiedDateFrom
          required: false
          description: Date from for last update date of data
          schema:
            $ref: '#/components/schemas/lastModifiedDateFromParam'
        - in: query
          name: lastModifiedDateTo
          required: false
          description: Date to for last update date of data
          schema:
            $ref: '#/components/schemas/lastModifiedDateToParam'
        - in: query
          name: externalRef
          required: false
          description: Article reference code of the source
          schema:
            $ref: '#/components/schemas/ExternalRefQueryParam'
        - in: query
          name: source
          required: false
          description: Source application and instance
          schema:
            $ref: '#/components/schemas/SourceQueryParam'
        - in: query
          name: codes
          required: false
          description: List of article code
          schema:
            $ref: '#/components/schemas/CodeListQueryParameter'
        - in: query
          name: ean
          required: false
          description: List of ean
          schema:
            $ref: '#/components/schemas/EanListQueryParameter'
      responses:
        '200':
          $ref: '#/components/responses/ArticlesResponseDTO'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestDTO'
              examples:
                InvalidPageSize:
                  value:
                    errors:
                      - error: must be greater than or equal to 1
                        property: pageSize
                InvalidPageNumber:
                  value:
                    errors:
                      - error: must be greater than or equal to 1
                        property: pageNumber
                InvalidDatesOrder:
                  value:
                    errors:
                      - error: 'dateFrom : 2024-07-01T00:00:00 is greater than dateTo'
                        property: lastModifiedDateFrom
        '500':
          $ref: '#/components/responses/InternalErrorDTO'
security:
  - OAuth2: []
    ApiKeyAuth: []
components:
  securitySchemes:
    OAuth2:
      type: oauth2
      flows: {}
    ApiKeyAuth:
      type: apiKey
      in: header
      name: clientid
  schemas:
    CreateArticleQueryDTO:
      type: object
      properties:
        externalRef:
          $ref: '#/components/schemas/ExternalRef'
      required:
        - externalRef
    CreateArticleResponseDTO:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/ArticleCode'
    PageNumberParam:
      type: integer
      format: int32
      example: '2'
      minimum: 1
      maximum: 1000
      description: Number of the page requested, minimum 1
    PageSizeParam:
      type: integer
      format: int32
      example: '2'
      minimum: 1
      maximum: 1000
      description: Size of the page
    lastModifiedDateFromParam:
      type: string
      format: date-time
      example: '2024-05-02T10:00:00'
      description: Last modified date from, must have the format yyyy-MM-ddTHH:mm:ss
    lastModifiedDateToParam:
      type: string
      format: date-time
      example: '2024-05-02T10:00:00'
      description: Last modified date to, must have the format yyyy-MM-ddTHH:mm:ss
    ExternalRefQueryParam:
      type: string
      example: '1000045'
      description: Article reference code of the source
      maxLength: 255
    SourceQueryParam:
      type: string
      example: GENES
      description: Source application and instance
      maxLength: 255
    CodeListQueryParameter:
      type: array
      description: List of code delimited by ,
      minItems: 1
      maxItems: 100
      example: 123,234
      items:
        $ref: '#/components/schemas/ArticleCode'
    EanListQueryParameter:
      type: array
      description: List of ean delimited by ,
      minItems: 1
      maxItems: 100
      example: 32974327943,789456
      items:
        $ref: '#/components/schemas/ArticleEan'
    ArticlesResponseDTO:
      type: object
      properties:
        pagination:
          description: Pagination information
          $ref: '#/components/schemas/PaginationDTO'
        articles:
          type: array
          maxItems: 1000
          items:
            description: Articles information
            $ref: '#/components/schemas/ArticleDTO'
    ArticleDTO:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/ArticleCode'
        name:
          $ref: '#/components/schemas/ArticleName'
        brand:
          $ref: '#/components/schemas/ArticleBrand'
        ean:
          $ref: '#/components/schemas/ArticleEan'
        clearClassCode:
          $ref: '#/components/schemas/ArticleClearClassCode'
        references:
          type: array
          maxItems: 1000
          items:
            description: Article references
            $ref: '#/components/schemas/ArticleReferenceDTO'
    ArticleCode:
      type: integer
      format: int32
      example: '1000001'
      description: Article identifier
    ArticleName:
      type: string
      example: MICHELIN CROSSCLIMATE 2 205/55 R16 94 V
      maxLength: 255
      description: Article name
    ArticleBrand:
      type: string
      example: Michelin
      maxLength: 255
      description: Article brand
    ArticleEan:
      type: string
      example: '32974327943'
      maxLength: 255
      description: Article ean
    ArticleClearClassCode:
      type: string
      example: LTA11124
      maxLength: 255
      description: Article clear class code
    ArticleReferenceDTO:
      type: object
      properties:
        source:
          $ref: '#/components/schemas/Source'
        externalRef:
          $ref: '#/components/schemas/ExternalRef'
        countryCode:
          $ref: '#/components/schemas/CountryCode'
        lastModifiedDate:
          $ref: '#/components/schemas/LastModifiedDate'
    Source:
      type: string
      example: ES_EQUITY
      maxLength: 20
      description: Source application and instance
    ExternalRef:
      type: string
      example: AAA123
      maxLength: 255
      description: Article reference code of the source
    CountryCode:
      type: string
      example: ES
      maxLength: 255
      description: Reference country code
    LastModifiedDate:
      description: Date when the external reference was last modified.
      type: string
      example: '2024-05-02T10:00:00'
      pattern: >-
        ^([0-9]{4})-(?:[0-9]{2})-([0-9]{2})T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$
    PaginationDTO:
      type: object
      additionalProperties: false
      properties:
        next:
          type: string
          maxLength: 200
          description: Url for next page
          example: /article-erm/v1/articles?pageNumber=3&pageSize=50
        previous:
          type: string
          maxLength: 200
          description: Url for previous page
          example: /article-erm/v1/articles?pageNumber=1&pageSize=50
        pageTotal:
          type: integer
          format: int32
          example: '2'
          minimum: 0
          maximum: 1000
          description: Number total of page available
        totalElements:
          type: integer
          format: int32
          example: '200'
          minimum: 0
          maximum: 10000
          description: Number total of elements available
    BadRequestDTO:
      type: object
      properties:
        errors:
          type: array
          minItems: 1
          items:
            type: object
            properties:
              error:
                type: string
                format: string
                description: Error message
              property:
                type: string
                format: string
                description: The name of the field affected by the error
    ForbiddenDTO:
      type: object
      properties:
        errors:
          type: array
          minItems: 1
          items:
            type: object
            properties:
              error:
                type: string
                format: string
                description: Error message
              property:
                type: string
                format: string
                description: The name of the field affected by the error
    InternalErrorDTO:
      type: object
      properties:
        error:
          type: string
          example: Unexpected error
    UnauthorizedDTO:
      type: object
      properties:
        errors:
          type: array
          minItems: 1
          items:
            type: object
            properties:
              error:
                type: string
                format: string
                description: Error message
              property:
                type: string
                format: string
                description: The name of the field affected by the error
  responses:
    ArticlesResponseDTO:
      description: Articles
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ArticlesResponseDTO'
          examples:
            standardResponse:
              value:
                pagination:
                  next: /article-erm/v1/articles?pageNumber=3&pageSize=50
                  previous: /article-erm/v1/articles?pageNumber=1&pageSize=50
                  pageTotal: '3'
                  totalElements: '125'
                articles:
                  - code: '1000001'
                    name: MICHELIN CROSSCLIMATE 2 205/55 R16 94 V
                    brand: Michelin
                    ean: '32974327943'
                    clearClassCode: LTA11124
                    references:
                      - source: ES_EQUITY
                        externalRef: '12345'
                        countryCode: ES
                        lastModifiedDate: 2024-12-27:12:23:23
    CreateArticleResponseDTO:
      description: Create article response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateArticleResponseDTO'
          examples:
            standardResponse:
              value:
                code: '1000293'
    UnauthorizedDTO:
      description: The requester is not recognized by our system.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthorizedDTO'
          examples:
            Unknown client id:
              summary: Unknown client id
              value:
                errors:
                  - error: Unknown client id, please contact our API service support
                    property: clientid
            Missing client id:
              summary: Missing client id
              value:
                errors:
                  - error: The client id is missing
                    property: clientid
            Bad credentials:
              summary: The credentials are wrong
              value:
                errors:
                  - error: The credentials are wrong
                    property: Authorization
            Missing credentials:
              summary: The credentials are missing
              value:
                errors:
                  - error: The credentials are missing
                    property: Authorization
    InternalErrorDTO:
      description: An internal error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalErrorDTO'
          examples:
            internalError:
              summary: An internal error occurred
              value:
                errors:
                  - error: >-
                      An internal error occurred, please try again later. Thank
                      you for your understanding
