Pricing Rule

The pricing rule resource.

Basehttps://rest.carbon.ms/pricingRule
GET/pricingRule

List pricing rules

Retrieve a paginated list of pricing rules. Filter, order, and select columns with PostgREST query parameters.

Query parameters

selectstring

Comma-separated columns to return. Defaults to all.

orderstring

Column to sort by, e.g. `createdAt.desc`.

limitinteger

Maximum rows to return.

offsetinteger

Rows to skip, for pagination.

GEThttps://rest.carbon.ms/pricingRule
curl --request GET \
  --url 'https://rest.carbon.ms/pricingRule?select=*&limit=10' \
  --header 'Authorization: Bearer <api-key>'
Response
[
  {
    "id": "abc123def456",
    "name": "Example",
    "ruleType": "string",
    "amountType": "string",
    "amount": 0,
    "priority": 0,
    "active": true,
    "companyId": "xyz789"
  }
]
GET/pricingRule

Retrieve a pricing rule

Fetch a single pricing rule by filtering on `id`.

Query parameters

idstring

Match on the pricing rule's `id`, e.g. `eq.{id}`.

GEThttps://rest.carbon.ms/pricingRule
curl --request GET \
  --url 'https://rest.carbon.ms/pricingRule?id=eq.%7Bid%7D' \
  --header 'Authorization: Bearer <api-key>'
Response
{
  "id": "abc123def456",
  "name": "Example",
  "ruleType": "string",
  "amountType": "string",
  "amount": 0,
  "priority": 0,
  "active": true,
  "companyId": "xyz789"
}
POST/pricingRule

Create a pricing rule

Create a new pricing rule.

Body parameters

namestringrequired
ruleTypepricingRuleTyperequired
amountTypepricingRuleAmountTyperequired
amountnumberrequired
prioritynumberrequired
minQuantitynumber
maxQuantitynumber
customerIdsarray
customerTypeIdsarray
itemIdsarray
itemPostingGroupIdstring

References itemPostingGroup.id

validFromdate
validTodate
activebooleanrequired
companyIdstringrequired

References company.id

POSThttps://rest.carbon.ms/pricingRule
curl --request POST \
  --url https://rest.carbon.ms/pricingRule \
  --header 'Authorization: Bearer <api-key>' \
  --header 'Content-Type: application/json' \
  --header 'Prefer: return=representation' \
  --data '{"name":"Example","ruleType":"string","amountType":"string","amount":0,"priority":0,"active":true,"companyId":"xyz789"}'
Response
{
  "id": "abc123def456",
  "name": "Example",
  "ruleType": "string",
  "amountType": "string",
  "amount": 0,
  "priority": 0,
  "active": true,
  "companyId": "xyz789"
}
PATCH/pricingRule

Update a pricing rule

Update an existing pricing rule, matched on `id`.

Body parameters

namestringrequired
ruleTypepricingRuleTyperequired
amountTypepricingRuleAmountTyperequired
amountnumberrequired
prioritynumberrequired
minQuantitynumber
maxQuantitynumber
customerIdsarray
customerTypeIdsarray
itemIdsarray
itemPostingGroupIdstring

References itemPostingGroup.id

validFromdate
validTodate
activebooleanrequired
companyIdstringrequired

References company.id

PATCHhttps://rest.carbon.ms/pricingRule
curl --request PATCH \
  --url 'https://rest.carbon.ms/pricingRule?id=eq.%7Bid%7D' \
  --header 'Authorization: Bearer <api-key>' \
  --header 'Content-Type: application/json' \
  --header 'Prefer: return=representation' \
  --data '{"name":"Example"}'
Response
{
  "id": "abc123def456",
  "name": "Example",
  "ruleType": "string",
  "amountType": "string",
  "amount": 0,
  "priority": 0,
  "active": true,
  "companyId": "xyz789"
}
DELETE/pricingRule

Delete a pricing rule

Delete a pricing rule, matched on `id`. Returns 204 No Content.

Query parameters

idstring

The `id` of the pricing rule to delete, e.g. `eq.{id}`.

DELETEhttps://rest.carbon.ms/pricingRule
curl --request DELETE \
  --url 'https://rest.carbon.ms/pricingRule?id=eq.%7Bid%7D' \
  --header 'Authorization: Bearer <api-key>'
204 No Content