Custom Attributes
Custom Attributes are flexible, tailored attributes that allow you to extend the entities in the Piggy system.
Currently, Custom Attributes can be created for the following entities:
business_profilesFor entity: Business Profile (or Shop)contactFor entity: ContactrewardFor entity: RewardpromotionFor entity: Promotion (note: use this one when working with Vouchers)voucherFor entity: Voucher (note: this is for individual vouchers, you'll likely need Promotion insteadgiftcardFor entity: Giftcardgiftcard_transactionFor entity: Giftcard TransactionprepaidFor entity: Prepaid TransactionbookingFor entity: BookingvisitFor entity: VisitshiftFor entity: ShiftIf you're missing any entity here, please reach out so we can see if we can make it happen on short notice.
List Custom Attributes
Get a list of Custom Attributes for a specified entity.
https://api.piggy.eu/api//custom-attributesBearer {{ access_token | api_key }}application/jsonentitystringREQUIRED1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
"data": [
{
"entity": "voucher",
"name": "acme_promotion_id",
"label": "Acme Promotion ID",
"type": "text",
"group_name": null,
"group": {
"name": "General",
"created_by_user": null,
"position": 1
},
"is_piggy_defined": false,
"is_soft_read_only": false,
"is_hard_read_only": false,
"has_unique_value": false,
"description": "Promotion for Acme discount logic",
"options": null,
"position": 1,
"created_at": "2023-11-13T16:04:14+00:00",
"meta": [],
}
]
}Create Custom Attribute
Creates a new Custom Attribute for a specified entity. You need to provide essential details like the entity type, name, label, and data type of the attribute. There's also the option to add a description and, for select attributes, an array of options.
https://api.piggy.eu/api//custom-attributesBearer {{ access_token | api_key }}application/jsonBody
entitystringREQUIREDnamestringREQUIREDlabelstringREQUIREDtypestringREQUIREDoptionsarrayOPTIONALdescriptionstringOPTIONALgroup_namestringOPTIONAL1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
"data": {
"entity": "promotion",
"name": "discount_type",
"label": "Discount Type",
"type": "select",
"group": {
"name": "General",
},
"is_piggy_defined": false,
"is_soft_read_only": false,
"is_hard_read_only": false,
"has_unique_value": false,
"description": "Type of discount for this Voucher",
"options": [
{
"value": "percentage",
"label": "Percentage",
},
{
"value": "fixed",
"label": "Fixed",
},
],
"created_at": "2023-11-13T16:04:14+00:00",
},
"meta": []
}Update Custom Attribute
Updates the properties of a Custom Attribute. Note that only the label, description, options for selects and multiselects, group can be updated. Attributes defined by the system cannot be updated.
https://api.piggy.eu/api//custom-attributes/{{custom_attribute_name}}Bearer {{ access_token | api_key }}application/jsonBody
entitystringREQUIREDlabelstringOPTIONALoptionsarrayOPTIONALdescriptionstringOPTIONALgroup_namestringOPTIONAL1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
"data": {
"entity": "promotion",
"name": "discount_type",
"label": "Discount Type",
"type": "select",
"group": {
"name": "General",
},
"is_piggy_defined": false,
"is_soft_read_only": false,
"is_hard_read_only": false,
"has_unique_value": false,
"description": "Type of discount for this Voucher",
"options": [
{
"value": "percentage",
"label": "Percentage",
},
{
"value": "fixed",
"label": "Fixed",
},
],
"created_at": "2023-11-13T16:04:14+00:00",
},
"meta": []
}