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 {{ 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
"data": [
{
"id": 2234,
"entity": "voucher",
"name": "rens_123",
"label": "Rens123",
"type": "select",
"group_name": null,
"group": {
"id": 141,
"name": "General",
"created_by_user": null,
"position": 1
},
"is_piggy_defined": false,
"is_soft_read_only": false,
"is_hard_read_only": false,
"field_type": null,
"has_unique_value": false,
"description": "some description",
"options": [
{
"value": "100",
"label": "Blue",
"description": null,
"media": null
},
{
"value": "200",
"label": "Red",
"description": null,
"media": null
},
{
"value": "300",
"label": "Yellow",
"description": null,
"media": null
}
],
"position": 1,
"created_at": "2023-11-13T16:04:14+00:00",
"meta": [],
"can_be_deleted": true,
"last_used_date": null,
"created_by_user": null
}
]
}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 {{ 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 {{ 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": []
}