Skip to main content

Profile

Version: 1.0

The profile is information related to customers, including basic information, membership class, customer's accumulated points...

Authenticated access scopes: loy.read_profiles, loy.write_profiles


What you can do with Profile

The Haravan API lets you do the following with the Profile resource.

The Profile resource

Details
{
"id": 632910392,
"first_name": "John",
"last_name": "Terry",
"phone": "0909977921",
"email": "[email protected]",
"gender": "male",
"birthday": "1901-01-01",
"address": "Số 1 đường Nguyễn Huệ",
"country_code": "VN",
"country_name": "Viet Nam",
"province_code": "HC",
"province_name": "Hồ Chí Minh",
"district_code": "HC466",
"district_name": "Quận 1",
"ward_code": "Quận 1",
"ward_name": "Phường Bến Thành",
"point_used": 900,
"point_available": 100,
"point_incoming": 0,
"point_ranking": 10000,
"level_id": 2020,
"level_name": "Member",
"total_spent": 1000000,
"total_order": 5,
"status": "enabled",
"attributes": [
{
"id": 207119551,
"key": "ref_id",
"value": "1010"
}
],
"last_order_at": "2020-05-08T04:08:06.000000Z",
"created_at": "2020-05-08T04:08:06.000000Z",
"updated_at": "2020-05-08T04:08:06.000000Z"
}

Properties


id : string

"id": 632910392

An unsigned 64-bit integer that's used as a unique identifier for the profile.

first_name : string

"first_name": "John"

The profile's first name.

last_name : string

"last_name": "Smith"

The profile's last name.

phone : string

"phone": "0902966921"

The profile's phone number.

email : string

The profile's email address.

gender : string

"gender": "male"

The profile's gender. Default value: null. Valid values:

  • unknow: Empty info.
  • male: The profile is male.
  • female: The profile is female.

birthday : string

"birthday": "1998-01-01"

The date (format YYYY-MM-DD) when the profile was born. Default value: null when empty info.

address : string

"address": "Số 1 đường Nguyễn Huệ"

The profile's address.

country_code : string

"country_code": "VN"

The two-letter country code corresponding to the profile's country.

country_name : string

"country_name": "Viet Nam"

The profile's normalized country name.

province_code : string

"province_code": "HC"

The two-letter province code for the profile's region.

province_name : string

"province_name": "Hồ Chí Minh"

The profile's region name. Typically a province, a state, or a prefecture.

district_code : string

"district_code": "HC466"

The standard abbreviation for the state or district.

district_name : string

"district_name": "HC466"

The full name of the state or district.

ward_code : string

"ward_code": "26734"

The standard abbreviation for the ward.

ward_name : string

"ward_name": "Phường Bến Thành" 

The profile's ward name.

point_used : integer

"point_used": 900

Profile's bonus points have been used.

point_available : integer

"point_available": 100

Profile's bonus points can be used.

point_incoming : integer

"point_incoming": 100

Profile Rewards Points are pending.

point_ranking : integer

"point_ranking": 10000

Profile's membership score.

level_id : integer

"level_id": 10000

A unique numeric identifier for the rank membership.

level_name : string

"level_name": "Member"

The name of rank member.

total_spent : integer

"total_spent": 1000000

The total amount of money that the profile has spent across their order history.

total_order : integer

"total_order": 10

The number of profile order history.

attributes : array<Object>

"attributes": [
{
"id": 207119551,
"key": "ref_id",
"value": "1010"
}
]

Extra information that is added to the customer profile. Each array entry must contain a hash with key and value.

status : string

"status": "enabled"

Profile operation status. Default value: "enabled". Valid values:

  • enabled: The profile is active.
  • disabled: The profile is not active.

last_order_at : datetime

"last_order_at": "2020-05-08T04:08:06.000000Z"

The last time the profile made a purchase (ISO 8601 format). Default value: null.

created_at : datetime

"created_at": "2020-05-08T04:08:06.000000Z"

The date and time (ISO 8601 format) when the profile was created.

updated_at : datetime

"updated_at": "2020-05-08T04:08:06.000000Z"

The date and time (ISO 8601 format) when the profile was last updated.

Retrieves a list of profiles

  • GET https://apis.haravan.com/loy/profiles.json

Retrieves a list of profiles. You can filter resources by params.

ParamDescription
since_idRestrict results to after the specified ID
fieldscomma-separated list of fields to include in the response.
phoneRestrict results by profile's phone.
updated_at_minShow profile last updated after date (format: 2008-12-31T02:01:27.483Z).
updated_at_maxShow profile last updated before date (format: 2008-12-31T02:01:27.483Z).
limitLimit of the result.
pagePage to show the result.

Retrieve all profiles by page number. By default, the number of resources on the page is 50.

Example Request:

  • GET https://apis.haravan.com/loy/profiles.json?page=1
Response
HTTP/1.1 200 OK

{
"profiles": [
{
"id": 360455,
"first_name": "",
"last_name": "test",
"gender": "unknown",
"birthday": null,
"profile_card_number": "100006037116",
"phone": "",
"email": "[email protected]",
"address": "",
"country_code": "vn",
"country_name": "Vietnam",
"province_code": "",
"province_name": "",
"district_code": "",
"district_name": "",
"ward_code": "",
"ward_name": "",
"point_used": 900,
"point_available": 6100,
"point_ranking": 10350,
"point_incoming": 0,
"level_id": 2106,
"level_name": "Member",
"total_spent": 1035000,
"total_order": 6,
"status": "enabled",
"last_order_at": "2020-05-08T04:08:06.000000Z",
"created_at": "2020-04-15T09:28:57.000000Z",
"updated_at": "2020-07-21T08:33:36.000000Z"
}
]
}

Retrieves single the profile

  • GET https://apis.haravan.com/loy/profiles/{id}.json

Retrieves single the profile.

Example Request:

  • GET https://apis.haravan.com/loy/profiles/360455.json
Response
HTTP/1.1 200 OK

{
"profile": {
"id": 360455,
"first_name": "",
"last_name": "test",
"gender": "unknown",
"birthday": null,
"profile_card_number": "100006037116",
"phone": "",
"email": "[email protected]",
"address": "",
"country_code": "vn",
"country_name": "Vietnam",
"province_code": "",
"province_name": "",
"district_code": "",
"district_name": "",
"ward_code": "",
"ward_name": "",
"point_used": 900,
"point_available": 6100,
"point_ranking": 10350,
"point_incoming": 0,
"level_id": 2106,
"level_name": "Member",
"total_spent": 1035000,
"total_order": 6,
"status": "enabled",
"last_order_at": "2020-05-08T04:08:06.000000Z",
"created_at": "2020-04-15T09:28:57.000000Z",
"updated_at": "2020-07-21T08:33:36.000000Z"
}
}

Retrieves tags of specify profile

  • GET https://apis.haravan.com/loy/profiles/{id}/tags.json

Retrieves tags of profile.

Example Request:

  • GET https://apis.haravan.com/loy/profiles/360455/tags.json
Response
HTTP/1.1 200 OK

{
"profile": {
"tags": "MUA_HANG_KM,Online,Facebook"
}
}

Retrieves attributes of specify profile

  • GET https://apis.haravan.com/loy/profiles/{id}/attributes.json

Retrieves attributes of profile.

Example Request:

  • GET https://apis.haravan.com/loy/profiles/360455/attributes.json
Response
HTTP/1.1 200 OK

{
"profile": {
"attributes": [
{
"id": 1210,
"key": "ref_id",
"value": "1010"
},
{
"id": 1211,
"key": "customer_level_prev_id",
"value": "2991"
}
]
}
}

Add point to specify profile

  • PUT https://apis.haravan.com/loy/profiles/{id}/points/add.json

Scope:

  • loy.write_profiles

Example Request:

PUT https://apis.haravan.com/loy/profiles/632910392/points/add.json

{
"point": {
"value": 10,
"reason": "Mini game quay số 11/11",
"ref_id": ""
}
}
Response
HTTP/1.1 200 OK

{
"id": 632910392,
"first_name": "John",
"last_name": "Terry",
"phone": "0909977921",
"email": "[email protected]",
"gender": "male",
"birthday": "1901-01-01",
"address": "Số 1 đường Nguyễn Huệ",
"country_code": "VN",
"country_name": "Viet Nam",
"province_code": "HC",
"province_name": "Hồ Chí Minh",
"district_code": "HC466",
"district_name": "Quận 1",
"ward_code": "Quận 1",
"ward_name": "Phường Bến Thành",
"point_used": 900,
"point_available": 110,
"point_incoming": 0,
"point_ranking": 10000,
"level_id": 2020,
"level_name": "Member",
"total_spent": 1000000,
"total_order": 5,
"status": "enabled",
"attributes": [
{
"id": 207119551,
"key": "ref_id",
"value": "1010"
}
],
"last_order_at": "2020-05-08T04:08:06.000000Z",
"created_at": "2020-05-08T04:08:06.000000Z",
"updated_at": "2020-05-08T04:08:06.000000Z"
}

Subtract point to specify profile

  • PUT https://apis.haravan.com/loy/profiles/{id}/points/subtract.json

Scope:

  • loy.write_profiles

Example Request:

PUT https://apis.haravan.com/loy/profiles/632910392/points/subtract.json

{
"point": {
"value": 10,
"reason": "Dùng điểm ở KOV mã ĐH #001234",
"ref_id": "1234"
}
}
Response
HTTP/1.1 200 OK

{
"id": 632910392,
"first_name": "John",
"last_name": "Terry",
"phone": "0909977921",
"email": "[email protected]",
"gender": "male",
"birthday": "1901-01-01",
"address": "Số 1 đường Nguyễn Huệ",
"country_code": "VN",
"country_name": "Viet Nam",
"province_code": "HC",
"province_name": "Hồ Chí Minh",
"district_code": "HC466",
"district_name": "Quận 1",
"ward_code": "Quận 1",
"ward_name": "Phường Bến Thành",
"point_used": 900,
"point_available": 100,
"point_incoming": 0,
"point_ranking": 10000,
"level_id": 2020,
"level_name": "Member",
"total_spent": 1000000,
"total_order": 5,
"status": "enabled",
"attributes": [
{
"id": 207119551,
"key": "ref_id",
"value": "1010"
}
],
"last_order_at": "2020-05-08T04:08:06.000000Z",
"created_at": "2020-05-08T04:08:06.000000Z",
"updated_at": "2020-05-08T04:08:06.000000Z"
}