Getting user information
Contents
- Overview
- Version-specific information
- Permissions and Authentication
- Headers
- HTTP Parameters
- Sample requests
- Sample response
Overview
- Call name: get-user
- Endpoint URL: https://api0.spaaza.com/internal/get-user
- Request methods: GET
- Response Content-Type: application/json
- Auth required: yes
This API call retrieves information about an existing user account and returns their details.
Version-specific information
The following version-specific changes apply to this endpoint. See the versioning page for more details.
| Version | Change details |
|---|---|
| >= 1.6.1 | Endpoint can now be called using privileged authentication to get the permissions of an admin user. Note that the permissions of the admin user will only be returned if the optionalAttributes parameter is set to permissions in the request. |
| >= 1.4.10 | The gender parameter returned supports values male, female, nonbinary, transgender, agender, genderqueer, genderfluid, bigender, twospirit, androgynous, pangender, neutrois, demigender and other. |
Permissions and Authentication
This API call requires valid authentication. The following authentication types are supported:
User authentication: A session generated by an end-user login. When using user authentication, the user information returned is for the authenticated user. No additional parameters are required.
Admin authentication: The performing user needs to be logged in and have read access to the chain with which the target user account is associated. When using admin authentication:
- The
chain_idparameter is required to identify the chain - One user identification parameter must be provided:
user_id,username,member_number,authentication_point_identifier,auxiliary_identifier, orreferral_code - When using the
usernameparameter for lookup, theX-Spaaza-MyPrice-App-Hostnameheader is required
Privileged authentication: The use of privileged authentication is permitted for this endpoint. When using privileged authentication:
- The
X-Spaaza-MyPrice-App-Hostnameheader is required - One user identification parameter must be provided:
user_id,username,member_number,authentication_point_identifier,auxiliary_identifier, orreferral_code - Important: To retrieve details for an admin user using privileged authentication, only the
user_idparameter can be used. Other identifier parameters (username, member_number, etc.) will not work for admin users with privileged authentication.
Headers
The following headers can/must be passed to the API call:
| Parameter | Description |
|---|---|
| X-Spaaza-MyPrice-App-Hostname | (conditional) The hostname of the app which the user is associated with. This header is: - Mandatory when using privileged authentication - Mandatory when using admin authentication with the username parameter- Optional when using admin authentication with other identifier parameters - Not used when using user authentication |
HTTP Parameters
The following HTTP parameters can be passed to the API:
| Parameter | Description |
|---|---|
| chain_id | (integer, conditional) Required when using admin authentication. The chain ID to which the user is connected. |
| user_id | (integer, conditional) The ID of the user. This parameter can be used with admin or privileged authentication to identify which user to retrieve. When using privileged authentication to retrieve an admin user, this is the only identifier parameter that will work. |
| username | (string, conditional) The username of the user in email address form. This parameter can be used with admin or privileged authentication to identify which user to retrieve. When using this parameter with admin authentication, the X-Spaaza-MyPrice-App-Hostname header is required. Note that this parameter cannot be used to retrieve admin users when using privileged authentication. |
| member_number | (string, conditional) The member number of the user. This parameter can be used with admin or privileged authentication to identify which user to retrieve. Note that this parameter cannot be used to retrieve admin users when using privileged authentication. |
| authentication_point_identifier | (string, conditional) The ID of the user in a third-party identity system such as a webstore. This parameter can be used with admin or privileged authentication to identify which user to retrieve. Note that this parameter cannot be used to retrieve admin users when using privileged authentication. |
| auxiliary_identifier | (string, conditional) An auxiliary identifier used by the retailer or other organization. This parameter can be used with admin or privileged authentication to identify which user to retrieve. Note that this parameter cannot be used to retrieve admin users when using privileged authentication. |
| referral_code | (string, conditional) The referral code of the user. This parameter can be used with admin or privileged authentication to identify which user to retrieve. Note that this parameter cannot be used to retrieve admin users when using privileged authentication. |
| optionalAttributes | (string, optional) Comma-separated list of optional attributes to include in the response. Currently supported value: permissions. When permissions is included, the response will contain permission information for admin users (when using admin authentication with appropriate permissions, or when using privileged authentication to retrieve an admin user). |
| display_signature | (boolean, optional) When set to true, includes signature information in the response. Defaults to false. |
Sample requests
Privileged authentication - regular user:
GET /internal/get-user?user_id=3935159
Headers:
Authorization: Bearer {access_token_id}:{access_token_secret}
X-Spaaza-MyPrice-App-Hostname: mystore.myprice.spaaza.com
Privileged authentication - admin user with permissions:
GET /internal/get-user?user_id=123456&optionalAttributes=permissions
Headers:
Authorization: Bearer {access_token_id}:{access_token_secret}
X-Spaaza-MyPrice-App-Hostname: mystore.myprice.spaaza.com
Admin authentication:
GET /internal/get-user?user_id=3935159&chain_id=1739
Headers:
X-Spaaza-Session-User-ID: {admin_user_id}
X-Spaaza-Session-Key: {session_key}
Admin authentication with username:
GET /internal/get-user?username=user@example.com&chain_id=1739
Headers:
X-Spaaza-Session-User-ID: {admin_user_id}
X-Spaaza-Session-Key: {session_key}
X-Spaaza-MyPrice-App-Hostname: mystore.myprice.spaaza.com
User authentication:
GET /internal/get-user
Headers:
X-Spaaza-Session-User-ID: {user_id}
X-Spaaza-Session-Key: {session_key}
Sample response
The endpoint returns an OK code and a JSON object containing the user information. A sample response:
{
"result": {
"code": 1,
"status": "ok"
},
"results": {
"user_info": {
"address_housenumber": "46",
"address_housenumber_extension": "B",
"address_latitude": null,
"address_line_2": "Apartment #416",
"address_line_3": null,
"address_longitude": null,
"address_postalcode": "1015CB",
"address_regionstate": "Any State",
"address_streetname": "Any Street",
"address_towncity": "Amsterdam",
"authentication_point": null,
"authentication_point_identifier": "99911166488945",
"auxiliary_identifier": null,
"average_basket_value": "0.00",
"birthday": "1981-07-21",
"business_group": null,
"country_code": "NL",
"created_date": "2024-01-31 15:15:43",
"days_since_last_purchase": null,
"entity_code": {
"code": "3935159",
"type": "regular"
},
"favorite_store": null,
"first_name": "Josephine",
"frequency": 1,
"gender": "M",
"id": 3935159,
"is_employee": false,
"is_influencer": false,
"language": null,
"last_modified_date": "2024-01-31 15:21:05",
"last_name": "Bloggs",
"loyalty_status": {
"date_reached": null,
"last_review_date": "2024-01-31T15:15:43+00:00",
"loyalty_level_id": null,
"monetary_balance_current": 0,
"next_review_date": null,
"points_balance_current": 5,
"points_to_proceed_next_level": null,
"points_to_remain_current_level": null
},
"mailing_list": {
"mailing_list_sub_offered": false,
"mailing_list_subscribed": true,
"printed_mailing_list_subscribed": true
},
"member_number": "3935159",
"monetary": 3,
"number_of_purchases": 0,
"obfuscated": false,
"offline_shopper": false,
"online_shopper": false,
"opt_in_programme": {
"join_date": "2024-01-31T15:15:43+00:00",
"programme_opted_in": true
},
"opt_in_secondary": false,
"opt_in_secondary_last_modified_date": "2024-01-31 15:15:43",
"overall": 3,
"phone_number": "+31655222555",
"points_wallet_total": 5,
"push_notification_subscription": {
"subscribed": false,
"subscriptions": []
},
"recency": 5,
"referral_channel": null,
"referral_code": "gzo85d",
"referred": true,
"referring_user": {
"authentication_point_identifier": null,
"campaign_id": 2539,
"id": 3930871,
"referral_channel": null,
"referral_code": "4t38p9"
},
"registered": true,
"signup_channel": null,
"signup_store": {
"signup_store_id": 1383,
"signup_store_name": "MOCO Museum store"
},
"stores": "",
"total_cashback_balance": 0,
"user_id": 3935159,
"username": "somedude0.11073246009398896@spaaza.com"
},
"result_type": "get-user"
}
}