Members

End-users save credits at loyalty programs through their member entity. For this entity, you may get the information of existing Members, or create new Members. These are in their essence simplistic calls and quite straightforward.



Get Member

Retrieve a Member's information and their Credit Balance for this Loyalty Program.

GETMember

https://api.piggy.nl/api//members/{member_id}

HEADERS

AuthorizationBearer {{ api_key }}

PARAMETERS

member_idnumber
REQUIREDThe Member's ID

Code

Message

7002
Account inactive.
55018
Loyalty Program not active.
1102
Shop not linked to a Loyalty Program.
55012
Member not found.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 { "data": { "member": { "id": 1, "email": "member@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "firstName": "John", "lastName": "Doe", "numberOfPets": 3, "favouriteAnimal": "Dog", "birthDate": '1975-01-22' } } ] }, "credit_balance": { "balance": 150 } }, }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 { "data": { "member": { "id": 1, "email": "member@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "firstName": "John", "lastName": "Doe", "numberOfPets": 3, "favouriteAnimal": "Dog", "birthDate": '1975-01-22' } } ] }, "credit_balance": null }, }


List Members

List Members for a Loyalty program.

GETList Members

https://api.piggy.nl/api//members?page=2&limit=50

HEADERS

AuthorizationBearer {{ api_key }}

PARAMETERS

pagenumber
OPTIONALPage number. Default = 1.
limitnumber
OPTIONALMaximum number of members to retrieve. Default value = 30, limit max = 100.

Code

Message

7002
Account inactive.
55018
Loyalty Program not active.
1102
Shop not linked to a Loyalty Program.
1008
Shop not found.
1003
Invalid input.
55012
Member not found.
1 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 { "data": { { "id": 1, "email": "member_001@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "current-credit-balance": 817, "credit-receptions-count": 8 } } ] }, { "id": 2, "email": "member_002@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "first-name": "John", "last-name": "Doe", "current-credit-balance": 10, "credit-receptions-count": 1 } } ] }, { "id": 3, "email": "member_003@piggy.eu", "loyalty_program_member_attributes": [] }, { "id": 4, "email": "member_004@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "first-name": "Jane", "last-name": "Doe", "current-credit-balance": 421, "credit-receptions-count": 11 } } ] }, { "id": 5, "email": "member_005@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "first-name": "Brian", "last-name": "Johnson", "current-credit-balance": 178, "credit-receptions-count": 5 } } ] }, { "id": 6, "email": "member_006@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "first-name": "Vera", "last-name": "De Vries", "current-credit-balance": 210, "credit-receptions-count": 6 } } ] }, { "id": 7, "email": "member_007@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "first-name": "Michael", "last-name": "Baker", "current-credit-balance": 1164, "credit-receptions-count": 34 } } ] }, { "id": 8, "email": "member_008@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "first-name": "Stan", "current-credit-balance": 199, "credit-receptions-count": 9 } } ] }, { "id": 9, "email": "member_009@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "first-name": "Stacy", "last-name": "Adelaide", "current-credit-balance": 12, "credit-receptions-count": 1 } } ] }, { "id": 10, "email": "member_010@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "first-name": "Frank", "last-name": "Shortbottom", "current-credit-balance": 665, "credit-receptions-count": 12 } } ] }, ], "meta": { "page": 1, "limit": 10, "last_page": 105, "total": 1042 } }


Get Member by Email Address

Retrieve a Member's information and their Credit Balance for this Loyalty Program by email address .

GETFind Member by Email Address

https://api.piggy.nl/api//members/find-one-by?email={{email}}&shop_id={shop_id}

HEADERS

AuthorizationBearer {{ api_key }}

PARAMETERS

emailstring
REQUIREDThe Member's email address

Code

Message

7002
Account inactive.
55018
Loyalty Program not active.
1102
Shop not linked to a Loyalty Program.
1003
Invalid input.
55012
Member not found.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 { "data": { "member": { "id": 1, "email": "member@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "firstName": "John", "lastName": "Doe", "numberOfPets": 3, "favouriteAnimal": "Dog", "birthDate": '1975-01-22' } } ] }, "credit_balance": { "balance": 150 } }, }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 { "data": { "member": { "id": 1, "email": "member@piggy.eu", "loyalty_program_member_attributes": [ { "attributes": { "firstName": "John", "lastName": "Doe", "numberOfPets": 3, "favouriteAnimal": "Dog", "birthDate": '1975-01-22' } } ] }, "credit_balance": null }, }


Create Member

Whenever an end-user wants to start saving credits at your Loyalty Program and they haven't yet started saving credits at any Loyalty Program, a new Member needs to be created for that end-user. To do so, an email address needs to be registered. If the end-user would like to use a Loyalty Card to save credits as well, a Link Loyalty Card to Member call can be used.

Keep in mind that creating a Member does not create a Customer entity for that customer. If desired, they'll need to do so themselves using either the Piggy Customer app (iOS/Android) or the Customer Dashboard.

POSTCreate Member

https://api.piggy.nl/api//members

HEADERS

AuthorizationBearer {{ api_key }}

BODY

emailstring
REQUIREDThe email address with which the Member is to be registered

Code

Message

7002
Account inactive.
55018
Loyalty Program not active.
1102
Shop not linked to a Loyalty Program.
1003
Invalid input.
55017
Member already exists.
1 2 3 4 5 6 { "data": { "id": 1, "email": "member@piggy.eu" } }


Update Member

Sets the Custom Attributes for the Member. Note: the Custom Attributes to be set, must already be created in the Business Dashboard. Also, make sure the Custom Attribute Name and Type match before updating. You might either get an error (in case the type is incorrect) or the Custom Attribute simply won't be set (in case the name is incorrect).

To get a better understanding of Custom Attributes, click here.

PUTUpdate Member

https://api.piggy.nl/api//members/{member_id}

HEADERS

AuthorizationBearer {{ api_key }}

PARAMETERS

member_idnumber
REQUIREDThe Member's ID

BODY

custom_attributesarray
REQUIREDArray of custom attributes that are to be set.

Code

Message

7002
Account inactive.
55018
Loyalty Program not active.
1102
Shop not linked to a Loyalty Program.
1003
Invalid input.
55012
Member not found.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 { "data": { "id": 1, "email": "member@piggy.eu", "created_at": "2021-01-25T12:00:00+00:00", "loyalty_program_member_attributes": [ { "attributes": { "firstName": "John", "lastName": "Doe", "numberOfPets": 3, "favouriteAnimal": "Dog", "birthDate": '1975-01-22' } } ] }, }

Related