swagger: '2.0'
info:
  version: '2.0'
  title: offers
consumes:
  - application/json
produces:
  - application/json
paths:
  /offers:
    get:
      tags:
        - offers
      description: Get a collection of offers.
      operationId: getOffers
      parameters:
        - name: id
          in: query
          description: The Offer ID.
          required: false
          type: integer
          format: int64
        - name: startDate
          in: query
          description: 'The start of the time range during which this Offer is effective. This is a valid ISO 8601 date 2018-05-29T11:00:00Z.'
          required: false
          type: string
          format: date-time
        - name: catalogEntryId
          in: query
          description: The catalog entry offered for sale. Please see the catalog entry data API for details.
          required: false
          type: integer
          format: int64
        - name: endDate
          in: query
          description: 'The end of the time range during which this Offer is effective. This is a valid ISO 8601 date 2018-05-29T11:00:00Z.'
          required: false
          type: string
          format: date-time
        - name: precedence
          in: query
          description: 'When more than one Offer is effective at a particular time, the one with the highest precedence is used.'
          required: false
          type: number
          format: double
        - name: published
          in: query
          description: 'Describes whether or not the offer has been published as follows: \n0 = not published (temporarily disabled).\n1 = published.\n2 = marked for deletion (and not published).'
          required: false
          type: integer
          format: int32
        - name: updatedDate
          in: query
          description: The last time this Offer was updated.
          required: false
          type: string
          format: date-time
        - name: minimumQuantity
          in: query
          description: The minimum quantity that can be purchased in a single Order under this Offer.
          required: false
          type: number
          format: double
        - name: maximumQuantity
          in: query
          description: The maximum quantity that can be purchased in a single Order under this Offer.
          required: false
          type: number
          format: double
        - name: field1
          in: query
          description: A customizable field.
          required: false
          type: string
        - name: field2
          in: query
          description: A customizable field.
          required: false
          type: string
        - name: flags
          in: query
          description: A field reserved for internal use only.
          required: false
          type: integer
          format: int32
        - name: identifier
          in: query
          description: A number that uniquely identifies this Offer along with its specified catalog entry and price list identifier.
          required: false
          type: integer
          format: int64
        - name: quantityUnit
          in: query
          description: 'A unit of measure for minimumQuantity and maximumQuantity. If the value is NULL, then the minimumQuantity and maximumQuantity are multiplied by nominal quantity for a product, used for pricing and the unit of measure of the results.'
          required: false
          type: string
        - name: priceListId
          in: query
          description: The trading position container or price list this Offer is part of.  Please see the trading position container data API for details.
          required: false
          type: integer
          format: int64
        - name: workspace.name
          in: query
          description: The unique system-generated code for identifying the workspace. This identifier is not the name that is assigned to the workspace by the Workspace Manager.
          required: false
          type: string
        - name: workspace.taskGroup
          in: query
          description: The unique system-generated code for identifying the task group. This identifier is not the name that is assigned to the task group by the Workspace Manager.
          required: false
          type: string
        - name: workspace.task
          in: query
          description: The unique system-generated code for identifying the task. This identifier is not the name that is assigned to the task by the Workspace Manager.
          required: false
          type: string
        - name: offset
          in: query
          description: 'The position within the resulting dataset where the query begins returning item records. If the offset is "5", the records that returned begin with the sixth record that matches the query parameters. If the offset is "0", the records that are returned begin with the first record that matches the query parameters.'
          required: false
          type: integer
          format: int32
        - name: limit
          in: query
          description: The maximum number of records to return.
          required: false
          type: integer
          format: int32
        - name: fields
          in: query
          description: 'The comma-separated set of properties to be returned. If no properties are specified, all properties are returned.'
          required: false
          type: string
        - name: expand
          in: query
          description: 'The comma-separated set of related resources referenced in the links to be returned. If no related resources are specified, no related resources are returned.'
          required: false
          type: string
        - name: sort
          in: query
          description: 'The comma-separated set of properties which controls the order of the items being listed, prefixed by either (-) to sort by descending order, or optionally (+) to sort by ascending order. For example, sort=name,-d which means, order the items based on the name value in ascending order, then by the id value in descending order.'
          required: false
          type: string
      responses:
        '200':
          description: A collection of offers.
          schema:
            $ref: '#/definitions/OfferCollection'
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
    post:
      tags:
        - offers
      description: Create an offer.
      operationId: createOffer
      parameters:
        - in: body
          name: Offer
          description: The offer.
          required: true
          schema:
            $ref: '#/definitions/Offer'
        - name: workspace.name
          in: query
          description: The unique system-generated code for identifying the workspace. This identifier is not the name that is assigned to the workspace by the Workspace Manager.
          required: false
          type: string
        - name: workspace.taskGroup
          in: query
          description: The unique system-generated code for identifying the task group. This identifier is not the name that is assigned to the task group by the Workspace Manager.
          required: false
          type: string
        - name: workspace.task
          in: query
          description: The unique system-generated code for identifying the task. This identifier is not the name that is assigned to the task by the Workspace Manager.
          required: false
          type: string
      responses:
        '201':
          description: The operation was successful.
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
  '/offers/{id}':
    get:
      tags:
        - offers
      description: Get an offer.
      operationId: getOfferById
      parameters:
        - name: workspace.name
          in: query
          description: The unique system-generated code for identifying the workspace. This identifier is not the name that is assigned to the workspace by the Workspace Manager.
          required: false
          type: string
        - name: workspace.taskGroup
          in: query
          description: The unique system-generated code for identifying the task group. This identifier is not the name that is assigned to the task group by the Workspace Manager.
          required: false
          type: string
        - name: workspace.task
          in: query
          description: The unique system-generated code for identifying the task. This identifier is not the name that is assigned to the task by the Workspace Manager.
          required: false
          type: string
        - name: fields
          in: query
          description: 'The comma-separated set of properties to be returned. If no properties are specified, all properties are returned.'
          required: false
          type: string
        - name: expand
          in: query
          description: 'The comma-separated set of related resources referenced in the links to be returned. If no related resources are specified, no related resources are returned.'
          required: false
          type: string
        - name: sort
          in: query
          description: 'The comma-separated set of properties which controls the order of the items being listed, prefixed by either (-) to sort by descending order, or optionally (+) to sort by ascending order. For example, sort=name,-d which means, order the items based on the name value in ascending order, then by the id value in descending order.'
          required: false
          type: string
      responses:
        '200':
          description: The offer.
          schema:
            $ref: '#/definitions/Offer'
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '404':
          description: The resource was not found.
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
    delete:
      tags:
        - offers
      description: Delete an offer.
      operationId: deleteOfferById
      parameters:
        - name: workspace.name
          in: query
          description: The unique system-generated code for identifying the workspace. This identifier is not the name that is assigned to the workspace by the Workspace Manager.
          required: false
          type: string
        - name: workspace.taskGroup
          in: query
          description: The unique system-generated code for identifying the task group. This identifier is not the name that is assigned to the task group by the Workspace Manager.
          required: false
          type: string
        - name: workspace.task
          in: query
          description: The unique system-generated code for identifying the task. This identifier is not the name that is assigned to the task by the Workspace Manager.
          required: false
          type: string
      responses:
        '204':
          description: The operation was successful.
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '404':
          description: The resource was not found.
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
    patch:
      tags:
        - offers
      description: Update an offer.
      operationId: updateOfferById
      parameters:
        - in: body
          name: Offer
          description: The offer.
          required: true
          schema:
            $ref: '#/definitions/Offer'
        - name: workspace.name
          in: query
          description: The unique system-generated code for identifying the workspace. This identifier is not the name that is assigned to the workspace by the Workspace Manager.
          required: false
          type: string
        - name: workspace.taskGroup
          in: query
          description: The unique system-generated code for identifying the task group. This identifier is not the name that is assigned to the task group by the Workspace Manager.
          required: false
          type: string
        - name: workspace.task
          in: query
          description: The unique system-generated code for identifying the task. This identifier is not the name that is assigned to the task by the Workspace Manager.
          required: false
          type: string
      responses:
        '200':
          description: The operation was successful.
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '404':
          description: The resource was not found.
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
    parameters:
      - name: id
        in: path
        description: The Offer ID.
        required: true
        type: integer
        format: int64
  '/offers/{id}/prices':
    get:
      tags:
        - offers
      description: ''
      operationId: getPricesOfOffer
      parameters:
        - name: offset
          in: query
          description: 'The position within the resulting dataset where the query begins returning item records. If the offset is "5", the records that returned begin with the sixth record that matches the query parameters. If the offset is "0", the records that are returned begin with the first record that matches the query parameters.'
          required: false
          type: integer
          format: int32
        - name: limit
          in: query
          description: The maximum number of records to return.
          required: false
          type: integer
          format: int32
        - name: fields
          in: query
          description: 'The comma-separated set of properties to be returned. If no properties are specified, all properties are returned.'
          required: false
          type: string
        - name: expand
          in: query
          description: 'The comma-separated set of related resources referenced in the links to be returned. If no related resources are specified, no related resources are returned.'
          required: false
          type: string
        - name: sort
          in: query
          description: 'The comma-separated set of properties which controls the order of the items being listed, prefixed by either (-) to sort by descending order, or optionally (+) to sort by ascending order. For example, sort=name,-d which means, order the items based on the name value in ascending order, then by the id value in descending order.'
          required: false
          type: string
      responses:
        '200':
          description: A collection of offer prices.
          schema:
            $ref: '#/definitions/OfferPriceCollection'
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
    parameters:
      - name: id
        in: path
        description: The Offer ID.
        required: true
        type: integer
        format: int64
  '/offers/{id}/descriptions':
    get:
      tags:
        - offers
      description: ''
      operationId: getDescriptionsOfOffer
      parameters:
        - name: offset
          in: query
          description: 'The position within the resulting dataset where the query begins returning item records. If the offset is "5", the records that returned begin with the sixth record that matches the query parameters. If the offset is "0", the records that are returned begin with the first record that matches the query parameters.'
          required: false
          type: integer
          format: int32
        - name: limit
          in: query
          description: The maximum number of records to return.
          required: false
          type: integer
          format: int32
        - name: fields
          in: query
          description: 'The comma-separated set of properties to be returned. If no properties are specified, all properties are returned.'
          required: false
          type: string
        - name: expand
          in: query
          description: 'The comma-separated set of related resources referenced in the links to be returned. If no related resources are specified, no related resources are returned.'
          required: false
          type: string
        - name: sort
          in: query
          description: 'The comma-separated set of properties which controls the order of the items being listed, prefixed by either (-) to sort by descending order, or optionally (+) to sort by ascending order. For example, sort=name,-d which means, order the items based on the name value in ascending order, then by the id value in descending order.'
          required: false
          type: string
      responses:
        '200':
          description: A collection of offer descriptions.
          schema:
            $ref: '#/definitions/OfferDescriptionCollection'
        '400':
          description: There was a client error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
        '500':
          description: There was a server error.
          schema:
            $ref: '#/definitions/ErrorResponseContainer'
    parameters:
      - name: id
        in: path
        description: The Offer ID.
        required: true
        type: integer
        format: int64
definitions:
  Link:
    type: object
    properties:
      href:
        type: string
        format: uri
        description: The URL of the link.
    description: Links to related resources.
  Error:
    type: object
    properties:
      code:
        type: string
        description: The error message code.
      message:
        type: string
        description: The error message.
      messageKey:
        type: string
        description: The error message key.
      messageArguments:
        type: array
        description: The arguments used to construct the error message.
        items:
          type: object
      correlationId:
        type: string
        description: The unique identifier for the request.
      locale:
        type: string
        description: The locale of the error message.
    description: The error message item model.
  ErrorResponseContainer:
    type: object
    properties:
      requestId:
        type: string
        description: The request identifier.
      errors:
        type: array
        description: The errors.
        items:
          $ref: '#/definitions/Error'
    description: The error message model.
  Offer:
    type: object
    properties:
      id:
        type: integer
        format: int64
        description: The Offer ID.
      startDate:
        type: string
        format: date-time
        description: 'The start of the time range during which this Offer is effective. This is a valid ISO 8601 date 2018-05-29T11:00:00Z.'
      catalogEntryId:
        type: integer
        format: int64
        description: The catalog entry offered for sale. Please see the catalog entry data API for details.
      endDate:
        type: string
        format: date-time
        description: 'The end of the time range during which this Offer is effective. This is a valid ISO 8601 date 2018-05-29T11:00:00Z.'
      precedence:
        type: number
        format: double
        description: 'When more than one Offer is effective at a particular time, the one with the highest precedence is used.'
      published:
        type: integer
        format: int32
        description: 'Describes whether or not the offer has been published as follows: \n0 = not published (temporarily disabled).\n1 = published.\n2 = marked for deletion (and not published).'
      updatedDate:
        type: string
        format: date-time
        description: The last time this Offer was updated.
      minimumQuantity:
        type: number
        format: double
        description: The minimum quantity that can be purchased in a single Order under this Offer.
      maximumQuantity:
        type: number
        format: double
        description: The maximum quantity that can be purchased in a single Order under this Offer.
      field1:
        type: string
        description: A customizable field.
      field2:
        type: string
        description: A customizable field.
      flags:
        type: integer
        format: int32
        description: A field reserved for internal use only.
      identifier:
        type: integer
        format: int64
        description: A number that uniquely identifies this Offer along with its specified catalog entry and price list identifier.
      quantityUnit:
        type: string
        description: 'A unit of measure for minimumQuantity and maximumQuantity. If the value is NULL, then the minimumQuantity and maximumQuantity are multiplied by nominal quantity for a product, used for pricing and the unit of measure of the results.'
      priceListId:
        type: integer
        format: int64
        description: The trading position container or price list this Offer is part of.  Please see the trading position container data API for details.
      links:
        type: object
        description: Links to related resources.
        properties:
          prices:
            type: object
            description: ''
            properties:
              href:
                type: string
                description: The URL of the link.
          descriptions:
            type: object
            description: ''
            properties:
              href:
                type: string
                description: The URL of the link.
    description: The offer.
  OfferCollection:
    type: object
    properties:
      count:
        type: integer
        format: int64
        description: The total number of items.
      items:
        type: array
        description: The items.
        items:
          $ref: '#/definitions/Offer'
    description: A collection of offers.
  OfferPrice:
    type: object
    properties:
      offerId:
        type: integer
        format: int64
        description: The offer ID.
      currency:
        type: string
        description: The standard ISO currency code for the offer
      price:
        type: number
        description: The offer price in the currency.
    description: The offer price.
  OfferPriceCollection:
    type: object
    properties:
      count:
        type: integer
        format: int64
        description: The total number of items.
      items:
        type: array
        description: The items.
        items:
          $ref: '#/definitions/OfferPrice'
    description: A collection of offer prices.
  OfferDescription:
    type: object
    properties:
      offerId:
        type: integer
        format: int64
        description: The offer ID.
      languageId:
        type: integer
        format: int32
        description: 'The language of the description. For a list of integer language identifiers, please refer to the Knowledge Center.'
      description:
        type: string
        description: The offer description in the language.
    description: The Offer description.
  OfferDescriptionCollection:
    type: object
    properties:
      count:
        type: integer
        format: int64
        description: The total number of items.
      items:
        type: array
        description: The items.
        items:
          $ref: '#/definitions/OfferDescription'
    description: A collection of offer descriptions.
