Offers (1.0.0)

Download OpenAPI specification:Download

E-mail: support@fabric.inc License: fabric INC

fabric e-commerce Offers APIs allow you to to set up and manage stock keeping unit (SKU) prices. Its wide range of coupon and promotion features let you design deals ranging from single-use, customer-specific coupons to site-wide promotions.

Pricing

Pricing APIs enable you to add price details for one or many items.

Create Price

Enables you to create one or many prices in accordance with how many items are present in the itemIds array.

Request
header Parameters
required
object (XSiteContext)

The x-site-context is a JSON object that must contain account, stage, date, and channel attributes.
Authorization header is required if x-site-context is omitted.

x-api-key
required
string

The x-api-key enables you to access fabric APIs without Authorization. You must request fabric Inc to obtain this key.
Authorization header is required if x-api-key is omitted.

Request Body schema: application/json

A JSON object that contains price information.

required
number or string

The Pricelist Id or name.

itemIds
required
Array of numbers

A list of one or more identifiers of the items to be created.

itemSkus
Array of numbers

A list of Stock Keeping Units (SKUs) of the items to be created. If present, this array must have the same number of items as itemIds and each SKU will be associated with the ID in the same index.

required
Array of objects [ 1 .. 10 ] items

A list of the offers to be added and its properties.

Responses
200

Successfully creates price.

400

Client Error

500

Server Error

post/api-price/price
Request samples
application/json
{
  • "priceListId": 100000,
  • "itemIds": [
    ],
  • "itemSkus": [
    ],
  • "offers": [
    ]
}
Response samples
application/json
{
  • "_id": "616e011037a3810008cfb256",
  • "priceListId": 100000,
  • "isSoftDeleted": false,
  • "itemId": 1000011218,
  • "itemSku": "1234XYZ",
  • "offerId": 371922,
  • "offers": [
    ],
  • "createdAt": "2021-10-18T23:19:44.852Z",
  • "updatedAt": "2021-10-19T00:40:30.341Z",
  • "job": false
}

Get Price Details

Gets a list of prices or retrieves a single price by identifier or SKU.

Request
query Parameters
limit
number

It limits the number of records returned by the API, default is 10 if limit is not specified.

Example: limit=10
page
number

Number of records you wish to skip before selecting records, default is 1 if page is not specified.

Example: page=1
header Parameters
required
object (XSiteContext)

The x-site-context is a JSON object that must contain account, stage, date, and channel attributes.
Authorization header is required if x-site-context is omitted.

x-api-key
required
string

The x-api-key enables you to access fabric APIs without Authorization. You must request fabric Inc to obtain this key.
Authorization header is required if x-api-key is omitted.

Responses
200

Successfully retrieves price details.

400

Client error

500

Server error

get/api-price/price
Response samples
application/json
{
  • "query": {
    },
  • "prices": [
    ]
}

Get Price Details by Price ID

Enables you to get price details based on price identifiers.

Request
path Parameters
priceId
required
string

The objectID, itemId or itemSku of the price to be retrieved

Example: 1000011218
query Parameters
priceListId
required
string

PriceListId to get the price from.

Example: priceListId=100000
type
string

The type of id that is provided in path for priceId.

Enum: "id" "itemId" "itemSku"
Example: type=itemId
header Parameters
required
object (XSiteContext)

The x-site-context is a JSON object that must contain account, stage, date, and channel attributes.
Authorization header is required if x-site-context is omitted.

Responses
200

Successfully retrieves price details.

400

Client error

500

Server error

get/api-price/price/{priceId}
Response samples
application/json
{
  • "query": {
    },
  • "prices": [
    ]
}

Delete price by ID

Deletes a price in the service by item identifier or its SKU.

Request
path Parameters
priceId
required
string

The mongo objectID, itemId or itemSku of the price to be retrieved

Example: 1000011218
query Parameters
priceListId
required
string

PriceListId to get the price from.

Example: priceListId=100000
type
string

The type of id that is provided in path for priceId.

Enum: "id" "itemId" "itemSku"
Example: type=itemId
header Parameters
Authorization
string

The Authorization is a access-token (JWT) received after you log into copilot-application.
If Authorization is omitted, then x-site-context is required. Some calls require Authorization even with x-site-context.

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxMDk1YjE2Y2E4MDZjMDAwOGYyNjA4NSIsInJvbGVzIjpbIkFkbWluIl0sInBlcm1pc3Npb25zIjpbInJlYWQ6Y29sbGVjdGlvbiIsIndyaXRlOnVzZXIiLCJ3cml0ZTpza3VzZXQiLCJ3cml0ZTpyb2xlIiwicmVhZDpwZXJtaXNzaW9uIiwid3JpdGU6YXR0cmlidXRlLWdyb3VwIiwicmVhZDp1c2VyIiwicmVhZDpza3VzZXQiLCJ3cml0ZTphdHRyaWJ1dGUiLCJyZWFkOmF0dHJpYnV0ZSIsInJlYWQ6cm9sZSIsIndyaXRlOmNvbGxlY3Rpb24iLCJyZWFkOmF0dHJpYnV0ZS1ncm91cCJdLCJhY2NvdW50IjoiNjA5YWM3NTA1MWYxMWEwMDA3Y2YzOGIzIiwiYWNjb3VudElkIjoxNDAzNTUyMTE1LCJ1c2VyVHlwZSI6eyJraW5kIjoiUkVHSVNURVJFRCJ9LCJpYXQiOjE2Mzc1MzYzNjIsImV4cCI6MTYzNzUzODE2Mn0.aUrXJ8e5TsADHdlP61Zg21dgJFoFxe5jsASHDxTj1h-WtodEpMR150vTpIA0pfpy1-3rKXlcjoOi6xidADhqZw
required
object (XSiteContext)

The x-site-context is a JSON object that must contain account, stage, date, and channel attributes.
Authorization header is required if x-site-context is omitted.

Responses
200

Returns the deleted price

400

Client error

500

Server error

delete/api-price/price/{priceId}
Response samples
application/json
{
  • "_id": "616e011037a3810008cfb256",
  • "priceListId": 100000,
  • "isSoftDeleted": true,
  • "itemId": 1000011218,
  • "itemSku": "1234XYZ",
  • "offerId": 371922,
  • "offers": [
    ],
  • "createdAt": "2021-10-18T23:19:44.852Z",
  • "updatedAt": "2021-10-19T00:40:30.341Z",
  • "job": true
}

Get Offers for Items by Item IDs

Enables you to get offer price of items based on the item Ids.

Request
header Parameters
required
object (XSiteContext)

The x-site-context is a JSON object that must contain account, stage, date, and channel attributes.
Authorization header is required if x-site-context is omitted.

Request Body schema: application/json
itemIds
required
Array of numbers

Comma seperated list of ItemIds

priceListId
number

Price List ID

Responses
200

Successfully retrieves an array cotaining all the prices for items based on items identifiers.

400

Client Error

500

Server Error

post/api-price/offer/get-by-itemIds
Request samples
application/json
{
  • "itemIds": [
    ],
  • "priceListId": 100000
}
Response samples
application/json
[
  • {
    }
]

Get Prices of Items

Enables you to get prices for all items.

Request
header Parameters
required
object (XSiteContext)

The x-site-context is a JSON object that must contain account, stage, date, and channel attributes.
Authorization header is required if x-site-context is omitted.

Request Body schema: application/json
required
Array of objects non-empty

Items

Responses
200

Successfully gets prices for items.

400

Client Error

500

Server Error

post/api-price/v2/price/get
Request samples
application/json
{
  • "items": [
    ]
}
Response samples
application/json
[
  • {
    }
]

Add or Update Bulk Price

Enables you to add or update prices, in bulk. This API is secured by x-api-key.

Request
header Parameters
required
object (XSiteContext)

The x-site-context is a JSON object that must contain account, stage, date, and channel attributes.
Authorization header is required if x-site-context is omitted.

x-api-key
required
string

The x-api-key enables you to access the fabric API without Authorization. You must request fabric Inc to obtain this key.
Authorizationheader is required ifx-api-key` is omitted.

Request Body schema: application/json

Array of Items

Array
required
number or string

Pricelist Id or name. this is optional. Price will be updated for Default Pricelist if priceListId is not provided.

itemId
required
number

Item ID

itemSku
string

SKU

required
Array of objects [ 1 .. 10 ] items

Offers

Responses
200

Successful

400

Client error

500

Server error

post/api-price/price/bulk-insert
Request samples
application/json
[
  • {
    }
]
Response samples
application/json
[
  • {
    }
]

Promotions

Promotion APIs enable you to apply and verify promotions and discount coupons.

Validate Promotions

Enables you to validate a cart's promotions - coupon codes and implicit promotions - for specified item IDs.

Request
header Parameters
required
object (XSiteContext)

The x-site-context is a JSON object that must contain account, stage, date, and channel attributes.
Authorization header is required if x-site-context is omitted.

Request Body schema: application/json

A JSON object containing information to apply eligible promotions to cart items.

isLoggedIn
boolean

True indicates a logged in user and False indicates guest user.

userId
string

The 24 character system-generated ID of the logged-in user. This is auto-generated based on the Authorization Token (JWT token from the Login API) specified in the Headers.

promoCodes
Array of strings

The coupon codes applied by the user.

required
Array of objects (items)

The item details. At least one item must be specified.

Responses
200

Successful

400

Client Error

406

Promo is Expired

500

Server Error

post/api-price/promo/validate
Request samples
application/json
{
  • "isLoggedIn": false,
  • "userId": "5e2cfb9b45570b000864c4b5",
  • "promoCodes": [
    ],
  • "items": [
    ]
}
Response samples
application/json
{
  • "isSuccess": true,
  • "items": [
    ],
  • "appliedDiscounts": [
    ],
  • "discounts": [
    ]
}

Get List of Promotions.

Enables you to retrieve all the active promotions, in a paginated response.

Request
query Parameters
page
number

"Number of records you wish to skip before selecting records, default is 0 if not specified."

limit
number

limits the number of records returned by the api, default is 10 if limit is not specified

Example: limit=10
keyword
string

Retrive records by SKU name

Example: keyword=sku name test
header Parameters
required
object (XSiteContext)

The x-site-context is a JSON object that must contain account, stage, date, and channel attributes.
Authorization header is required if x-site-context is omitted.

Responses
200

Successfully gets list of all active promotions.

400

Client error

500

Server error

get/api-price/promo
Response samples
application/json
{
  • "query": {
    },
  • "promos": [
    ]
}

Get Promotions by promotion ID

Retrieves details of a specific promotion based on the specified promotion ID.

Request
path Parameters
promoId
required
string

Get promotions based on promotion ID

Example: 1000011218
header Parameters
required
object (XSiteContext)

The x-site-context is a JSON object that must contain account, stage, date, and channel attributes.
Authorization header is required if x-site-context is omitted.

Responses
200

Successfull

400

Client error

500

Server error

get/api-price/promo/{promoId}
Response samples
application/json
{
  • "_id": "5ff58d31358319306ac05349",
  • "promoCodes": [
    ],
  • "state": "ACTIVE",
  • "isImplicit": false,
  • "isExclusive": false,
  • "title": "HURRY",
  • "startDate": "2020-12-03T09:30:00.965Z",
  • "endDate": "2020-12-03T18:30:00.000Z",
  • "type": "PRODUCT",
  • "promo": [
    ],
  • "extra": { },
  • "limits": {
    },
  • "promoId": 1422,
  • "termsAndConditions": {
    },
  • "createdAt": "2021-01-06T10:13:05.169Z",
  • "updatedAt": "2021-01-06T10:36:41.038Z",
  • "__v": 0
}