swagger: '2.0'
info:
  title: Campaigns Admin REST APIs
  version: '2.0'
paths:
  /campaigns:
    get:
      produces:
        - application/json
      parameters:
        - description: The store ID.
          format: int32
          in: query
          name: storeId
          required: true
          type: integer
          x-context-data: storeId
        - description: The offset.
          format: int32
          in: query
          name: offset
          required: false
          type: integer
          x-entity-path: dataArea/get/recordSetStartNumber
        - description: The limit.
          format: int32
          in: query
          name: limit
          required: false
          type: integer
          x-entity-path: dataArea/get/maxItems
      responses:
        '200':
          description: The operation is successful.
          schema:
            $ref: '#/definitions/CampaignCollection'
          x-entity-path: dataArea/campaign
      summary: Gets the campaigns in a store.
      x-expression-template: '{_wcf.ap={accessProfile}}/Campaign'
      x-facade-client-class: com.ibm.commerce.marketing.facade.client.MarketingFacadeClient
      x-facade-client-method: getCampaign
      x-parameters:
        accessProfile: IBM_Admin_Details
      x-request-bod-class: com.ibm.commerce.marketing.facade.datatypes.GetCampaignType
    post:
      consumes:
        - application/json
      parameters:
        - description: The store ID.
          format: int32
          in: query
          name: storeId
          required: true
          type: integer
          x-context-data: storeId
          x-entity-path: >-
            dataArea/campaign[1]/campaignIdentifier/externalIdentifier/storeIdentifier/uniqueID
        - description: The request body.
          in: body
          name: body
          required: true
          schema:
            $ref: '#/definitions/Campaign'
          x-entity-path: 'dataArea/campaign[1]'
      responses:
        '201':
          description: The operation is successful.
          headers:
            Location:
              description: The URI of the campaign.
              type: string
          x-entity-path: 'dataArea/campaign[1]/campaignIdentifier/uniqueID'
      summary: Creates a campaign.
      x-action-code: Add
      x-expression-template: '/Campaign[1]'
      x-facade-client-class: com.ibm.commerce.marketing.facade.client.MarketingFacadeClient
      x-facade-client-method: processCampaign
      x-request-bod-class: com.ibm.commerce.marketing.facade.datatypes.ProcessCampaignType
  '/campaigns/by-activity-id/{activityId}':
    get:
      produces:
        - application/json
      parameters:
        - description: The activity ID
          format: int64
          in: path
          name: activityId
          required: true
          type: integer
      responses:
        '200':
          description: The operation is successful.
          schema:
            $ref: '#/definitions/Campaign'
          x-entity-path: 'dataArea/campaign[1]'
      summary: Gets a campaign by an activity id.
      x-expression-template: >-
        {_wcf.ap={accessProfile}}/Campaign[ActivityIdentifier[UniqueID={activityId}]]
      x-facade-client-class: com.ibm.commerce.marketing.facade.client.MarketingFacadeClient
      x-facade-client-method: getCampaign
      x-parameters:
        accessProfile: IBM_Admin_Details
      x-request-bod-class: com.ibm.commerce.marketing.facade.datatypes.GetCampaignType
  /campaigns/by-ids:
    get:
      produces:
        - application/json
      parameters:
        - description: The campaign ID
          format: int64
          in: query
          name: id
          required: true
          type: integer
        - description: The offset.
          format: int32
          in: query
          name: offset
          required: false
          type: integer
          x-entity-path: dataArea/get/recordSetStartNumber
        - description: The limit.
          format: int32
          in: query
          name: limit
          required: false
          type: integer
          x-entity-path: dataArea/get/maxItems
      responses:
        '200':
          description: The operation is successful.
          schema:
            $ref: '#/definitions/CampaignCollection'
          x-entity-path: dataArea/campaign
      summary: Gets Campaigns by IDs.
      x-expression-template: >-
        {_wcf.ap={accessProfile}}/Campaign[CampaignIdentifier[(UniqueID='{id}')]]
      x-facade-client-class: com.ibm.commerce.marketing.facade.client.MarketingFacadeClient
      x-facade-client-method: getCampaign
      x-parameters:
        accessProfile: IBM_Admin_Details
      x-request-bod-class: com.ibm.commerce.marketing.facade.datatypes.GetCampaignType
  /campaigns/by-name-or-description:
    get:
      produces:
        - application/json
      parameters:
        - description: The store ID.
          format: int32
          in: query
          name: storeId
          required: true
          type: integer
          x-context-data: storeId
        - description: The name or description pattern to search.
          in: query
          name: searchText
          required: true
          type: string
        - description: The offset.
          format: int32
          in: query
          name: offset
          required: false
          type: integer
          x-entity-path: dataArea/get/recordSetStartNumber
        - description: The limit.
          format: int32
          in: query
          name: limit
          required: false
          type: integer
          x-entity-path: dataArea/get/maxItems
      responses:
        '200':
          description: The operation is successful.
          schema:
            $ref: '#/definitions/CampaignCollection'
          x-entity-path: dataArea/campaign
      summary: Searches Campaigns by name or description.
      x-expression-builder-class: >-
        com.ibm.commerce.foundation.internal.client.taglib.util.SearchExpressionBuilder
      x-expression-builder-method: formatExpression
      x-facade-client-class: com.ibm.commerce.marketing.facade.client.MarketingFacadeClient
      x-facade-client-method: getCampaign
      x-parameters:
        accessProfile: IBM_Admin_Details
        template: >-
          /Campaign[search(CampaignIdentifier/ExternalIdentifier/Name='$searchText$'
          or Description='$searchText$')]
      x-request-bod-class: com.ibm.commerce.marketing.facade.datatypes.GetCampaignType
  '/campaigns/{id}':
    delete:
      parameters:
        - description: The campaign ID.
          format: int64
          in: path
          name: id
          required: true
          type: integer
          x-entity-path: 'dataArea/campaign[1]/campaignIdentifier/uniqueID'
      responses:
        '204':
          description: The operation is successful.
      summary: Deletes a campaign.
      x-action-code: Delete
      x-expression-template: '/Campaign[1]'
      x-facade-client-class: com.ibm.commerce.marketing.facade.client.MarketingFacadeClient
      x-facade-client-method: processCampaign
      x-request-bod-class: com.ibm.commerce.marketing.facade.datatypes.ProcessCampaignType
    get:
      produces:
        - application/json
      parameters:
        - description: The campaign ID
          format: int64
          in: path
          name: id
          required: true
          type: integer
      responses:
        '200':
          description: The operation is successful.
          schema:
            $ref: '#/definitions/Campaign'
          x-entity-path: 'dataArea/campaign[1]'
      summary: Gets a campaign.
      x-expression-template: >-
        {_wcf.ap={accessProfile}}/Campaign[CampaignIdentifier[(UniqueID='{id}')]]
      x-facade-client-class: com.ibm.commerce.marketing.facade.client.MarketingFacadeClient
      x-facade-client-method: getCampaign
      x-parameters:
        accessProfile: IBM_Admin_Details
      x-request-bod-class: com.ibm.commerce.marketing.facade.datatypes.GetCampaignType
    patch:
      consumes:
        - application/json
      parameters:
        - description: The campaign ID.
          format: int64
          in: path
          name: id
          required: true
          type: integer
          x-entity-path: 'dataArea/campaign[1]/campaignIdentifier/uniqueID'
        - description: The request body.
          in: body
          name: body
          required: true
          schema:
            $ref: '#/definitions/Campaign'
          x-entity-path: 'dataArea/campaign[1]'
      responses:
        '200':
          description: The operation is successful.
      summary: Updates a campaign.
      x-action-code: Change
      x-expression-template: '/Campaign[1]'
      x-facade-client-class: com.ibm.commerce.marketing.facade.client.MarketingFacadeClient
      x-facade-client-method: changeCampaign
      x-request-bod-class: com.ibm.commerce.marketing.facade.datatypes.ChangeCampaignType
definitions:
  Campaign:
    description: A campaign.
    properties:
      createdDateTime:
        description: The date and time when the marketing campaign was created.
        format: date-time
        type: string
        x-entity-path: created
      description:
        description: The description of the marketing campaign.
        type: string
      id:
        description: The marketing campaign ID.
        format: int64
        type: integer
        x-entity-path: campaignIdentifier/uniqueID
      name:
        description: The name of the marketing campaign.
        type: string
        x-entity-path: campaignIdentifier/externalIdentifier/name
      objective:
        description: The objectives and goals that the marketing campaign intends to reach.
        type: string
      owner:
        description: The name of the business owner of the campaign.
        type: string
      season:
        description: The season of the year in which the campaign should be run.
        type: string
      updatedDateTime:
        description: The date and time when the marketing campaign was created.
        format: date-time
        type: string
        x-entity-path: lastUpdate
    type: object
    x-entity-class: com.ibm.commerce.marketing.facade.datatypes.CampaignType
  CampaignCollection:
    description: A collection of campaigns.
    properties:
      count:
        format: int64
        type: integer
      items:
        items:
          $ref: '#/definitions/Campaign'
        type: array
    type: object
x-components: {}
