Link Search Menu Expand Document

Searching users

Overview

  • Call name: search
  • Endpoint URL: https://services-[API_ENVIRONMENT].spaaza.com/search/users
  • Request methods: HTTP POST
  • Auth required: yes

You can use this API endpoint to search for users in Spaaza. The endpoint returns multiple users, with the user with the best match returning first in the results.

The API_ENVIRONMENT value varies according to whether the request is being made to Spaaza’s production or staging API:

Environment API_ENVIRONMENT value
Production prod
Staging test01

Headers

The following headers are required:

Header Description
X-Spaaza-Session-User-Id Spaaza ID of the user obtained from the login endpoint
X-Spaaza-Session-Key Session key obtained from the login endpoint
X-Spaaza-Session-Chain-Id the ID of the Spaaza chain or retailer

The following authentication methods are permitted:

Method Description
admin A session generated by administrative user login.

Query Parameters (application/x-www-form-urlencoded)

This API accepts the following parameters:

Parameter Description
chain_id (integer, required) The ID of the Spaaza chain or retailer
page (integer, required) The page number of desired results
query (string, optional) End-user supplied search term(s) such as “Joe Bloggs”, “jane@example.com”, “221 Long Street, New York”, “(555) 123 4567” or a combination of all of these
count (integer, optional) Number of results to return
opted_in (boolean, optional) Filter the search to opted-in users. To search for all users do not pass this parameter.

Example Request & Response

Example request:

Overview

  • Call name: search
  • Endpoint URL: https://services-[API_ENVIRONMENT].spaaza.com/search/users
  • Request methods: HTTP POST
  • Auth required: yes

You can use this API endpoint to search for users in Spaaza.

The API_ENVIRONMENT value varies according to whether the request is being made to Spaaza’s production or staging API:

Environment API_ENVIRONMENT value
Production prod
Staging test01

Headers

The following headers are required:

Header Description
Session-User-Id Spaaza ID of the user obtained from the login endpoint
Session-Key Session key obtained from the login endpoint
Session-Chain-Id the ID of the Spaaza chain or retailer

The following authentication methods are permitted:

Method Description
admin A session generated by administrative user login.

Query Parameters (application/x-www-form-urlencoded)

This API accepts the following parameters:

Parameter Description
chain_id (integer, required) The ID of the Spaaza chain or retailer
page (integer, required) The page number of desired results
query (string, optional) End-user supplied search term(s)
count (integer, optional) Number of results to return
opted_in (boolean, optional) Filter the search to opted-in users. To search for all users do not pass this parameter.

Example Request & Response

Example request:

curl "-XPOST -v -k \
-H 'X-Spaaza-Session-User-Id: <your user ID>' \
-H 'X-Spaaza-Session-Key: <your session key>' \
-H 'X-Spaaza-Session-Chain-Id: <your chain ID>' \
-d 'chain_id=<your chain ID>’ \
-d 'query=sam test’ \
-d 'page=1 \
-d 'count=25 \
-d 'opted_in=1 \

'https://services-[API_ENVIRONMENT].spaaza.com/search/users'"

Example response:

[
    {
        "ResetLink": "",
        "address": {
            "address_regionstate": "Noord-Holland",
            "house_number": "551",
            "house_number_extension": "",
            "line_2": "",
            "line_3": "",
            "phone_number": "+31620555555",
            "postal_code": "1017BW",
            "street_name": "Herengracht",
            "towncity": "Amsterdam"
        },
        "authentication_point_identifier": "",
        "auxiliary_identifier": "",
        "birthday": "1980-11-11T00:00:00Z",
        "country_code": "NL",
        "created_date": "2023-09-11T14:55:44Z",
        "entity_code": {
            "code": "3928927"
        },
        "firstname": "Sam",
        "gender": "male",
        "home_store": {
            "home_store_id": "",
            "home_store_name": ""
        },
        "id": 3928927,
        "language": "nl-NL",
        "lastname": "Test Forty Two",
        "loyalty_status": {
            "date_reached": "2023-09-11T14:55:44Z",
            "last_review_date": "2023-09-11T14:55:44Z",
            "next_review_date": null,
            "points_balance_current": 5,
            "points_to_proceed_next_level": 95,
            "points_to_remain_current_level": 95
        },
        "loyalty_status_level": "Test",
        "mailing_list_subscribed": true,
        "opt_in_secondary": false,
        "printed_mailing_list_subscribed": false,
        "push_notification_subscription": {
            "subscribed": false
        },
        "referral": {
            "referral_code": "x9hqrz",
            "referred": false,
            "referring_user": {
                "id": 0,
                "referral_code": ""
            }
        },
        "registered": true,
        "signup_store": {
            "signup_store_id": "",
            "signup_store_name": ""
        },
        "signup_store.signup_store_id": 0,
        "spaaza_opted_in": true,
        "username": "test42@cowcam.com"
    },
    {
        "ResetLink": "",
        "address": {
            "address_regionstate": "",
            "house_number": "",
            "house_number_extension": "",
            "line_2": "",
            "line_3": "",
            "postal_code": "",
            "street_name": "",
            "towncity": ""
        },
        "authentication_point_identifier": "",
        "auxiliary_identifier": "",
        "birthday": null,
        "country_code": "NL",
        "created_date": "2023-07-26T08:16:45Z",
        "entity_code": {
            "code": "3927169"
        },
        "firstname": "Sam",
        "gender": "male",
        "home_store": {
            "home_store_id": "",
            "home_store_name": ""
        },
        "id": 3927169,
        "lastname": "20230726-test-001",
        "loyalty_status": {
            "date_reached": "2023-07-26T08:16:45Z",
            "last_review_date": "2023-07-26T08:16:45Z",
            "next_review_date": null,
            "points_balance_current": 5,
            "points_to_proceed_next_level": 95,
            "points_to_remain_current_level": 95
        },
        "loyalty_status_level": "Test",
        "mailing_list_subscribed": true,
        "opt_in_secondary": false,
        "printed_mailing_list_subscribed": false,
        "push_notification_subscription": {
            "subscribed": false
        },
        "referral": {
            "referral_code": "y65n93",
            "referred": false,
            "referring_user": {
                "id": 0,
                "referral_code": ""
            }
        },
        "registered": true,
        "signup_store": {
            "signup_store_id": "",
            "signup_store_name": ""
        },
        "signup_store.signup_store_id": 0,
        "spaaza_opted_in": true,
        "username": "20230726-test-001@cowcam.com"
    }
]