{
  "openapi": "3.0.1",
  "info": {
    "title": "Marketing Campaigns",
    "version": "9.1.20.0",
    "description": "Create and administer campaigns in a store.",
    "x-introduced": "9.1.0.0"
  },
  "servers": [
    {
      "url": "https://{hostname}:{port}/rest/admin/v2",
      "variables": {
        "port": {
          "default": "443",
          "enum": [
            "443",
            "8000"
          ]
        },
        "hostname": {
          "default": "localhost",
          "enum": [
            "localhost",
            "test.hcl.com"
          ]
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Marketing Campaigns",
      "description": "Create and administer campaigns in a store."
    }
  ],
  "paths": {
    "/campaigns": {
      "get": {
        "summary": "Get the campaigns in a store.",
        "tags": [
          "Marketing Campaigns"
        ],
        "parameters": [
          {
            "name": "storeId",
            "in": "query",
            "description": "The unique numeric ID for identifying the store.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "x-context-data": "storeId"
            },
            "x-context-data": "storeId"
          },
          {
            "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.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "x-entity-path": "dataArea/get/recordSetStartNumber"
            },
            "x-entity-path": "dataArea/get/recordSetStartNumber"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "The maximum number of records to return.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "x-entity-path": "dataArea/get/maxItems"
            },
            "x-entity-path": "dataArea/get/maxItems"
          }
        ],
        "responses": {
          "200": {
            "description": "The operation is successful.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignCollection"
                }
              }
            },
            "x-entity-path": "dataArea/campaign"
          }
        },
        "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": {
        "summary": "Create a campaign.",
        "tags": [
          "Marketing Campaigns"
        ],
        "parameters": [
          {
            "name": "storeId",
            "in": "query",
            "description": "The unique numeric ID for identifying the store.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "x-context-data": "storeId",
              "x-entity-path": "dataArea/campaign[1]/campaignIdentifier/externalIdentifier/storeIdentifier/uniqueID"
            },
            "x-context-data": "storeId",
            "x-entity-path": "dataArea/campaign[1]/campaignIdentifier/externalIdentifier/storeIdentifier/uniqueID"
          }
        ],
        "requestBody": {
          "description": "The request body.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Campaign"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The operation is successful.",
            "headers": {
              "Location": {
                "description": "The URI of the campaign.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {},
            "links": {
              "GetCampaignsByCampaignsId": {
                "operationRef": "#/paths/~1campaigns~1{id}/get",
                "parameters": {
                  "id": "$request.body#/id"
                },
                "description": "The `id` value used in the request body can be used as the `id` parameter in `GET /campaigns/{id}`.\n"
              },
              "DeleteCampaignsByCampaignsId": {
                "operationRef": "#/paths/~1campaigns~1{id}/delete",
                "parameters": {
                  "id": "$request.body#/id"
                },
                "description": "The `id` value used in the request body can be used as the `id` parameter in `DELETE /campaigns/{id}`.\n"
              },
              "UpdateCampaignsByCampaignsId": {
                "operationRef": "#/paths/~1campaigns~1{id}/patch",
                "parameters": {
                  "id": "$request.body#/id"
                },
                "description": "The `id` value used in the request body can be used as the `id` parameter in `PATCH /campaigns/{id}`.\n"
              }
            },
            "x-entity-path": "dataArea/campaign[1]/campaignIdentifier/uniqueID"
          }
        },
        "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",
        "x-codegen-request-body-name": "body"
      }
    },
    "/campaigns/by-activity-id/{activityId}": {
      "get": {
        "summary": "Get a campaign by an activity id.",
        "tags": [
          "Marketing Campaigns"
        ],
        "parameters": [
          {
            "name": "activityId",
            "in": "path",
            "description": "The activity ID",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The operation is successful.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Campaign"
                }
              }
            },
            "x-entity-path": "dataArea/campaign[1]"
          }
        },
        "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": {
        "summary": "Get Campaigns by IDs.",
        "tags": [
          "Marketing Campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "description": "The unique numeric ID for identifying the campaign.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "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.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "x-entity-path": "dataArea/get/recordSetStartNumber"
            },
            "x-entity-path": "dataArea/get/recordSetStartNumber"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "The maximum number of records to return.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "x-entity-path": "dataArea/get/maxItems"
            },
            "x-entity-path": "dataArea/get/maxItems"
          }
        ],
        "responses": {
          "200": {
            "description": "The operation is successful.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignCollection"
                }
              }
            },
            "x-entity-path": "dataArea/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"
      }
    },
    "/campaigns/by-name-or-description": {
      "get": {
        "summary": "Search Campaigns by name or description.",
        "tags": [
          "Marketing Campaigns"
        ],
        "parameters": [
          {
            "name": "storeId",
            "in": "query",
            "description": "The unique numeric ID for identifying the store.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "x-context-data": "storeId"
            },
            "x-context-data": "storeId"
          },
          {
            "name": "searchText",
            "in": "query",
            "description": "The name or description pattern to search.",
            "required": true,
            "schema": {
              "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.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "x-entity-path": "dataArea/get/recordSetStartNumber"
            },
            "x-entity-path": "dataArea/get/recordSetStartNumber"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "The maximum number of records to return.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "x-entity-path": "dataArea/get/maxItems"
            },
            "x-entity-path": "dataArea/get/maxItems"
          }
        ],
        "responses": {
          "200": {
            "description": "The operation is successful.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignCollection"
                }
              }
            },
            "x-entity-path": "dataArea/campaign"
          }
        },
        "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}": {
      "get": {
        "summary": "Get a campaign.",
        "tags": [
          "Marketing Campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The unique numeric ID for identifying the campaign.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The operation is successful.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Campaign"
                }
              }
            },
            "x-entity-path": "dataArea/campaign[1]"
          }
        },
        "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"
      },
      "delete": {
        "summary": "Delete a campaign.",
        "tags": [
          "Marketing Campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The unique numeric ID for identifying the campaign.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64",
              "x-entity-path": "dataArea/campaign[1]/campaignIdentifier/uniqueID"
            },
            "x-entity-path": "dataArea/campaign[1]/campaignIdentifier/uniqueID"
          }
        ],
        "responses": {
          "204": {
            "description": "The operation is successful.",
            "content": {}
          }
        },
        "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"
      },
      "patch": {
        "summary": "Update a campaign.",
        "tags": [
          "Marketing Campaigns"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The unique numeric ID for identifying the campaign.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64",
              "x-entity-path": "dataArea/campaign[1]/campaignIdentifier/uniqueID"
            },
            "x-entity-path": "dataArea/campaign[1]/campaignIdentifier/uniqueID"
          }
        ],
        "requestBody": {
          "description": "The request body.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Campaign"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "The operation is successful.",
            "content": {}
          }
        },
        "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",
        "x-codegen-request-body-name": "body"
      }
    }
  },
  "components": {
    "schemas": {
      "Campaign": {
        "type": "object",
        "properties": {
          "createdDateTime": {
            "type": "string",
            "description": "The date and time when the marketing campaign was created.",
            "format": "date-time",
            "x-entity-path": "created"
          },
          "description": {
            "type": "string",
            "description": "The description of the marketing campaign."
          },
          "id": {
            "type": "integer",
            "description": "The marketing campaign ID.",
            "format": "int64",
            "x-entity-path": "campaignIdentifier/uniqueID"
          },
          "name": {
            "type": "string",
            "description": "The name of the marketing campaign.",
            "x-entity-path": "campaignIdentifier/externalIdentifier/name"
          },
          "objective": {
            "type": "string",
            "description": "The objectives and goals that the marketing campaign intends to reach."
          },
          "owner": {
            "type": "string",
            "description": "The name of the business owner of the campaign."
          },
          "season": {
            "type": "string",
            "description": "The season of the year in which the campaign should be run."
          },
          "updatedDateTime": {
            "type": "string",
            "description": "The date and time when the marketing campaign was created.",
            "format": "date-time",
            "x-entity-path": "lastUpdate"
          }
        },
        "required": [
          "createdDateTime",
          "id",
          "name",
          "owner",
          "season",
          "updatedDateTime"
        ],
        "description": "A campaign.",
        "x-entity-class": "com.ibm.commerce.marketing.facade.datatypes.CampaignType"
      },
      "CampaignCollection": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer",
            "format": "int64"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Campaign"
            }
          }
        },
        "required": [
          "count",
          "items"
        ],
        "description": "A collection of campaigns."
      }
    },
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "security": [
    {
      "basicAuth": []
    }
  ],
  "x-components": {}
}
