import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.promotion.listRuleAttributes("rules", "standard")
.then(({ attributes }) => {
console.log(attributes)
}){
"attributes": [
{
"id": "customer_group",
"value": "customer.groups.id",
"label": "Customer Group",
"operators": [
{
"id": "in",
"value": "in",
"label": "In"
}
]
}
]
}Retrieve a list of potential rule attributes for the promotion and application method types specified in the query parameters. Only the attributes of the rule type specified in the path parameter are retrieved:
If rule_type is rules, the attributes of the promotion’s type are retrieved.
If rule_type is target-rules, the target rules’ attributes of the application method’s type are retrieved.
If rule_type is buy-rules, the buy rules’ attributes of the application method’s type are retrieved.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.promotion.listRuleAttributes("rules", "standard")
.then(({ attributes }) => {
console.log(attributes)
}){
"attributes": [
{
"id": "customer_group",
"value": "customer.groups.id",
"label": "Customer Group",
"operators": [
{
"id": "in",
"value": "in",
"label": "In"
}
]
}
]
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The rule type.
rules, target-rules, buy-rules The promotion type to retrieve rules for.
standard, buyget The application method type to retrieve rules for.
fixed, percentage The application method target type to retrieve rules for.
items, shipping_methods, order OK
The list of attributes.
The list of attributes.
Show child attributes
The rule attribute's ID, which is a rule's attribute it refers to.
"customer_group"
The rule attribute's value.
"customer.groups.id"
The rule attribute option's label.
"Customer Group"