{ "parameters": { "discountID": { "name": "discountID", "in": "query", "description": "Unique ID for the record. This or the code is required.", "required": false, "type": "integer" }, "discountIDRequired": { "name": "discountID", "in": "query", "description": "Unique ID for the record.", "required": true, "type": "integer" }, "codeForViewAndEdit": { "name": "code", "in": "query", "description": "Unique code for the record. This or the ID is required.", "required": false, "type": "string" }, "productID": { "name": "productID", "in": "query", "description": "The parent productID. The resulting list is retricted to Discounts associated with SKUs assigned to this product.", "required": false, "type": "integer" }, "skuID": { "name": "skuID", "in": "query", "description": "The parent skuID. The resulting list is retricted to Discounts associated with the SKU.", "required": false, "type": "integer" } }, "paths": { "/discount": { "get": { "summary": "Discount View", "description": "View the details of a Discount record.", "tags": [ "Administrative Operations" ], "parameters": [ { "$ref": "#/parameters/discountID" }, { "$ref": "#/parameters/codeForViewAndEdit" }, { "$ref": "../swagger-spec.json#/parameters/apiLoginIDParam" }, { "$ref": "../swagger-spec.json#/parameters/apiAuthenticationTokenParam" } ], "responses": { "200": { "description": "Discount object", "schema": { "$ref": "#/definitions/WrappedDiscount" } }, "default": { "description": "Error", "schema": { "$ref": "../swagger-spec.json#/definitions/Error" } } } }, "delete": { "summary": "Discount Delete", "description": "Delete a Discount record.", "tags": [ "Administrative Operations" ], "parameters": [ { "$ref": "#/parameters/discountIDRequired" }, { "$ref": "../swagger-spec.json#/parameters/apiLoginIDParam" }, { "$ref": "../swagger-spec.json#/parameters/apiAuthenticationTokenParam" } ], "responses": { "200": { "description": "Success", "schema": { "$ref": "#/definitions/WrappedDiscount" } }, "default": { "description": "Error", "schema": { "$ref": "../swagger-spec.json#/definitions/Error" } } } }, "patch": { "summary": "Discount Edit", "description": "Edits a Discount record.", "tags": [ "Administrative Operations" ], "parameters": [ { "name": "discount", "in": "body", "description": "The Discount to be edited. Either the discountID or code must be provided.", "required": true, "schema": { "$ref": "#/definitions/Discount" } }, { "$ref": "../swagger-spec.json#/parameters/apiLoginIDParam" }, { "$ref": "../swagger-spec.json#/parameters/apiAuthenticationTokenParam" } ], "responses": { "200": { "description": "Discount object", "schema": { "$ref": "#/definitions/WrappedDiscount" } }, "default": { "description": "Error", "schema": { "$ref": "../swagger-spec.json#/definitions/Error" } } } }, "post": { "summary": "Discount Add", "description": "Adds a Discount record.", "tags": [ "Administrative Operations" ], "parameters": [ { "name": "discount", "in": "body", "description": "The discount to be added.", "required": true, "schema": { "$ref": "#/definitions/NewDiscount" } }, { "$ref": "../swagger-spec.json#/parameters/apiLoginIDParam" }, { "$ref": "../swagger-spec.json#/parameters/apiAuthenticationTokenParam" } ], "responses": { "200": { "description": "Discount object", "schema": { "$ref": "#/definitions/WrappedDiscount" } }, "default": { "description": "Error", "schema": { "$ref": "../swagger-spec.json#/definitions/Error" } } } } }, "/discount/list": { "get": { "summary": "Discount List", "description": "View a list of Discounts.", "tags": [ "Administrative Operations" ], "parameters": [ { "$ref": "../swagger-spec.json#/parameters/itemsPerPage" }, { "$ref": "../swagger-spec.json#/parameters/firstRow" }, { "$ref": "../swagger-spec.json#/parameters/sortByString" }, { "$ref": "../swagger-spec.json#/parameters/sortAscOrDesc" }, { "$ref": "../swagger-spec.json#/parameters/searchString" }, { "$ref": "../swagger-spec.json#/parameters/parentIDField" }, { "$ref": "../swagger-spec.json#/parameters/assignments" }, { "$ref": "#/parameters/productID" }, { "$ref": "#/parameters/skuID" }, { "$ref": "../swagger-spec.json#/parameters/apiLoginIDParam" }, { "$ref": "../swagger-spec.json#/parameters/apiAuthenticationTokenParam" } ], "responses": { "200": { "description": "Discount List", "schema": { "$ref": "#/definitions/WrappedDiscountList" } }, "default": { "description": "Error", "schema": { "$ref": "../swagger-spec.json#/definitions/Error" } } } } } }, "definitions": { "BaseDiscount": { "type": "object", "properties": { "productID": { "description": "The productID of the product associated with this Discount.", "type": "integer", "default": 0 }, "skuID": { "description": "The skuID of the specific SKU associated with this Discount.", "type": "integer", "default": 0 }, "description": { "type": "string", "maxLength": 255 }, "isActive": { "description": "If false, this discount will not be available to customers.", "type": "boolean", "default": true }, "usersAppliesType": { "type": "string", "maxLength": 255, "default": "[allUsers]", "description": "Defines which users are able to get this discount. Valid values are: [allUsers], [loggedIn], [userNames], [customerStatuses], [previousOrderTotal]" }, "usersAppliesValue": { "type": "string", "maxLength": 255, "description": "The value of users corresponding to the usersAppliesType. Eg., if [userNames], a comma-separated list of user names that are able to get this discount." }, "itemsAppliesType": { "type": "string", "maxLength": 255, "default": "[global]", "description": "Valid values: [global], [shipping], [skus], [giftCertificate]" }, "itemsAppliesValue": { "type": "string", "maxLength": 255, "description": "Not used by default." }, "cartItemsType": { "type": "string", "maxLength": 255, "default": "[noItemsRequired]", "description": "Defines what items must be in the cart for the Discount to be valid. Valid values are: [noItemsRequired], [anyOneItem], [allItems]" }, "cartItemsValue": { "type": "string", "maxLength": 255, "description": "The value of cart items corresponding to the cartItemsType. Eg., if [allItems], a comma-separated list of Product.code values that must be in the user's cart for the Discount to be applied." }, "rewardType": { "type": "string", "maxLength": 255, "default": "[percentage]", "description": "Valid values: [percentage], [amount], [itemsForFree], [rangeByQuantity], [rangeByPrice]" }, "reward": { "type": "number", "maxLength": 255, "description": "The numerical value of the reward, whether it's a percentage discount, amount discount, etc. Note: this should be set to 0 for rangeByQuantity and rangeByPrice discounts, since for the those the reward is defined by the Discount Ranges." }, "couponCode": { "type": "string", "maxLength": 255, "description": "If this field is filled out, the discount is a coupon, meaning the customer has to enter it in order to receive the discount." }, "startDate": { "type": "string", "maxLength": 255, "description": "The date/time the Discount starts in yyyy-MM-dd HH:mm:ss:mmm format." }, "expirationDate": { "type": "string", "maxLength": 255, "description": "The date/time the Discount expires, after which it will no longer be available. in yyyy-MM-dd HH:mm:ss:mmm format." }, "timesUsed": { "type": "integer", "description": "The number of times this Discount has been used." }, "maxTimesUsed": { "type": "integer", "description": "The maximum number of times this Discount can be used, either overall (isTimesPerCustomer = 0), or by a single customer (isTimesPerCustomer = 1)." }, "isTimesPerCustomer": { "type": "boolean", "default": false, "description": "Determines if maxTimesUsed means the maximum number of times this Discount can be used overall, or by a single customer." }, "orderItemID": { "type": "integer", "description": "If this Discount is a purchased gift certificate, the original order item id representing the purchase." }, "discountOrder": { "type": "integer", "description": "The order in which this Discount will appear relative to other discounts. This field also determines the order in which Discounts are processed when they are applied to a customer's cart." }, "extra1": { "description": "Any extra, or custom information associated with this Discount.", "type": "string", "maxLength": 255 }, "extra2": { "description": "Any extra, or custom information associated with this Discount.", "type": "string", "maxLength": 255 }, "extra3": { "description": "Any extra, or custom information associated with this Discount.", "type": "string", "maxLength": 255 } } }, "NewDiscount": { "type": "object", "allOf": [ { "required": [ "code" ], "properties": { "name": { "description": "A name for this Discount as displayed to customers.", "type": "string", "maxLength": 255 }, "code": { "description": "A unique code for this Discount, used by the system to identify it. (No spaces, commas, or other unsafe characters. Pipe characters or equals signs are ok.) NOTE: this is not the Coupon Code.", "type": "string", "maxLength": 128 } } }, { "$ref": "#/definitions/BaseDiscount" } ] }, "Discount": { "type": "object", "allOf": [ { "properties": { "discountID": { "type": "integer", "description": "Unique identifier representing a specific Discount. This or the code is required." }, "name": { "description": "A name for this Discount, as displayed to customers.", "type": "string", "maxLength": 255 }, "code": { "description": "A unique code for this Discount, used by the system to identify it. (No spaces, commas, or other unsafe characters. Pipe characters or equals signs are ok.) NOTE: this is not the Coupon Code.", "type": "string", "maxLength": 128 } } }, { "$ref": "#/definitions/BaseDiscount" } ] }, "WrappedDiscount": { "type": "object", "properties": { "success": { "type": "boolean" }, "errors": { "type": "array", "items": { "type": "string" } }, "messages": { "type": "array", "items": { "type": "string" } }, "jsonResult": { "type": "object", "$ref": "#/definitions/Discount" } } }, "WrappedDiscountList": { "type": "object", "properties": { "success": { "type": "boolean" }, "errors": { "type": "array", "items": { "type": "string" } }, "messages": { "type": "array", "items": { "type": "string" } }, "jsonResult": { "type": "object", "properties": { "itemCollection": { "type": "array", "description": "The list of items being requested that match the criteria, limited to the number of itemsPerPage.", "items": { "$ref": "#/definitions/Discount" } }, "itemCount": { "description": "The total number of items matching the criteria. This value may used to compose paging parameters.", "type": "integer" } } } } } } }