swagger: '2.0'
info:
  title: Marketing API
  version: 1.0.0
host: qa-ows-marketing.theorchard.io
basePath: /
schemes:
  - https
paths:
  /hello:
    get:
      responses:
        '200':
          description: OK
        '503':
          description: 503 Internal Error
      description: DB health check for the application.
  /highlights:
    post:
      parameters:
        - in: body
          name: body
          required: true
          schema:
            $ref: '#/definitions/highlight'
      responses:
        '201':
          description: The marketing program info has been successfully created.
          schema:
            $ref: '#/definitions/highlight'
        '400':
          examples:
            default:
              code: validation_error
              message:
                subject: '''subject'' is a required property'
                description: '''description'' is a required property'
                scope: '''scope'' is a required property'
                mkt_program_id: '''mkt_program_id'' is a required property'
                client: '''client'' is a required property'
                entity_id: '''entity_id'' is a required property'
                attachment: '''attachment'' is a required property'
          description: |
            The creation was not successful. This is likely due because some
            fields are not following the right format or are missing from the
            request.
        '403':
          description: |
            When Grass headers are present but the entity (e.g. a release) is
            not marked as owned by this particular user, a 403 is returned.
      description: Create a marketing program info record.
  '/highlights/product/{productId}/copy/{newProductId}':
    post:
      parameters:
        - in: path
          name: productId
          required: true
          type: string
        - in: path
          name: newProductId
          required: true
          type: string
        - description: UUID
          in: header
          name: Correlation-Id
          type: string
      responses:
        '200':
          description: |
            HTTP 200 OK
            -----------
            Highlights were found for a product but were not copied to
            the new product. This is because the original product
            highlight description was empty.
        '201':
          description: |
            HTTP 201 Created
            -----------
            Product highlights were copied to the new product id.
        '400':
          description: |
            HTTP 400 Bad Request
            --------------------
            Validation failed.
        '403':
          description: |
            HTTP 403 Forbidden
            ------------------
            The server understood the request, but is refusing to fulfill
            it (product ownership check fail).
        '404':
          description: |
            HTTP 404 Not found
            ------------------
            Product was not found.
      description: Copy a product highlight to a new product
  '/highlights/{entityType}/{entityId}':
    delete:
      parameters:
        - in: path
          name: entityType
          required: true
          type: string
        - in: path
          name: entityId
          required: true
          type: string
        - description: Describes whether records added/updated from oa or alw
          in: query
          name: client
          type: string
      responses:
        '200':
          description: |
            The marketing program info was successfully deleted.
        '400':
          examples:
            default:
              code: validation_error
              message:
                highlight_id: '''highlight_id'' must be a number'
          description: |
            Bad request - this might be due because the highlight id is not
            valid.
        '403':
          description: |
            When Grass headers are present but the entity (e.g. a release) is
            not marked as owned by this particular user, a 403 is returned.
        '404':
          description: |
            The marketing program info was not found, and thus cannot be
            deleted.
      description: |
        Deletes marketing program info records with productID given.
    get:
      parameters:
        - in: path
          name: entityType
          required: true
          type: string
        - in: path
          name: entityId
          required: true
          type: string
        - description: |
            Place where fetching data should start.
          in: query
          name: offset
          type: number
        - description: |
            Limit the number of items to return.
          in: query
          name: limit
          type: number
        - description: |
            Describes whether records added/updated from oa or alw.
          in: query
          name: client
          type: string
      responses:
        '200':
          examples:
            default:
              pagination:
                total_records: 1
                offset: 0
                type: standard
                limit: 50
              items:
                - subject: Plastic Head Media - Candlelight/ 1349 - Hellfire One-Sheet
                  description: >-
                    Candlelight/Back On Black  Records one-sheet for 1349 -
                    Hellfire
                  scope: public
                  client: oa
                  entity_id: 16481
                  attachment: 'Y'
                  highlight_id: 8
                  entity: release
                  mkt_program_id: 12
          description: |
            Getting all the marketing marketing program info that relates to
            a particular entity (release, vendor, artist) by its id has been
            successful.
        '400':
          examples:
            default:
              code: validation_error
              message:
                offset: '''offset'' is not of type ''number'''
          description: |
            Bad request - error while validating one of the value that was
            provided as part of the request.
        '403':
          description: |
            Forbidden - this likely comes from a Grass user who is trying to
            access an entity it does not explicilty own.
        '404':
          description: |
            HTTP 404 Not found
            --------------------
            Marketing Program Info not found.
      description: |
        Retrieve a paginated list of marketing program info for the logged-in
        user. Pagination info will be used to retrieve the next subset of
        marketing program info for the user.
  '/highlights/{highlight_id}':
    put:
      parameters:
        - in: path
          name: highlight_id
          required: true
          type: string
        - in: body
          name: body
          required: true
          schema:
            $ref: '#/definitions/highlight'
      responses:
        '200':
          schema:
            $ref: '#/definitions/highlight'
          description: |
            Updating an existing highlight was successful.
        '400':
          examples:
            default:
              code: validation_error
              message:
                subject: '''subject'' is too short'
          description: |
            The creation was not successful. This is likely due because some
            fields are not following the right format or are missing from the
            request.
        '403':
          description: |
            When Grass headers are present but the entity (e.g. a release) is
            not marked as owned by this particular user, a 403 is returned.
        '404':
          description: |
            We were unable to find the marketing highlight that corresponds to
            this particular id, and thus we were not able to update it.
      description: |
        Update an existing marketing program info record. highlight_id which
        is the mkt_program_info_id, is the unique identifier for a marketing
        program info record.
definitions:
  highlight:
    properties:
      attachment:
        description: Flag if the marketing highlight contains an attachment.
        enum:
          - 'Y'
          - 'N'
        type: string
        example: 'N'
      client:
        description: Source of the Marketing Highlight.
        enum:
          - oa
          - alw
        type: string
        example: oa
      description:
        description: Description of the Marketing Highlight.
        type: string
        example: Description of the highlight
      entity:
        description: Entity Type.
        enum:
          - vendor
          - artist
          - release
          - track
          - ex_a_release
          - project
        type: string
        example: release
      entity_id:
        description: Id of the entity.
        type: number
        example: 601162
      highlight_id:
        description: Marketing Highlight Identifier.
        type: number
        example: 39640
      mkt_program_id:
        description: Marketing Program Id (also known as Highlight Id).
        type: number
        example: 10
      scope:
        description: Scope of the Marketing Highlight.
        enum:
          - public
          - internal_only
        type: string
        example: internal_only
      subject:
        description: Subject of the Marketing Highlight.
        maxLength: 255
        minLength: 5
        type: string
        example: Hello World
securityDefinitions: {}
