Link Search Menu Expand Document

Getting a users referrals

The result output is a JSON array with its results section being something to the lines of the following:

{
    "result": {
        "code": 1,
        "status": "ok"
    },
    "results": {
        "referrals": [
            {
                "referred_user": {
                    "user_id": 7,
                    "initials": "John S",
                    "created_date": "2021-08-04 12:07:52"
                },
                "referring_user": {
                    "user_id": 4
                }
            },
            {
                "referred_user": {
                    "user_id": 6,
                    "initials": "Jane S",
                    "created_date": "2021-08-04 12:07:51"
                },
                "referring_user": {
                    "user_id": 4
                }
            }
        ],
        "count": 2,
        "result_type": "get-campaign-referrals"
    }
}
  • Call name: get-campaign-referrals
  • Endpoint URL: https://apistage0.spaaza.com/get-campaign-referrals
  • Request methods: GET
  • Response Content-Type: application/json
  • Auth required: yes

Get the number of referrals by a referring user as well as a partially obfuscated list of referred users.

HTTP Parameters

The following HTTP parameters can be passed to the API:

Parameter Description
chain_id (Integer. Required with admin authentication.) The id of the chain for which the information is being requested.
user_id OR member_number OR username OR authentication_point_identifier (required with admin and privileged authentication) The id, member_number (user code), username (email address) or identity in a third-party authentication system (authentication_point_identifier) of the user for whom the card details are being requested.
campaign_id (Integer. Required) campaign_id of a referral campaign.

Permissions and Authentication

This API call requires a valid Spaaza session. The session can be as follows:

  • User authentication: a session generated by an end-user login.
  • Admin authentication: the performing user needs to be logged in and have read access to the entity (business or chain) to which the user is connected.
  • Privileged authentication: the use of privileged authentication is permitted for this endpoint.

Headers

The following headers can/must be passed to the API call:

Parameter Description
X-Spaaza-MyPrice-App-Hostname (mandatory) The hostname of the app for which the user is requesting the card.

Permissions

This API call requires no specific permissions.

Possible error responses

The following represents a list of possible error responses for the get-card endpoint:

Code Name and Description HTTP Status Code
1 username_invalid
The username is incorrectly formatted. Your username should be a valid email address.
400
6 no_valid_session
The user needs to be logged in and a valid session key needs to be sent
401
68 permission_denied_or_non_existent
This user has insufficient permissions for this object or the object does not exist.
500
144 business_id_not_found
No record has been found for that business_id
500
154 user_id_invalid
The user_id passed must be an integer up to 10 digits long
400
217 chain_id_not_found
No record has been found for that chain_id
400
228 auth_method_invalid
The given auth_method parameter has an invalid value.
500
405 entity_mismatch
The entities or chains supplied do not match. Unable to find a user matching the chain_id supplied
400
413 campaign_not_found
The campaign was not found
400
403 campaign_type_not_supported
This type of campaign is not supported. The campaign must be a referral campaign
400
264 myprice_app_without_entity
The requested MyPrice app does not have an entity associated with it.
400
265 authorization_invalid
The given authorization header is invalid.
400
267 no_valid_user
A valid username needs to be specified
401
269 no_myprice_app
Myprice app is required
400
270 user_not_found
No user was found
404
416 multiple_parameter_mismatch
Multiple parameters supplied when fewer are required
400
424 access_denied
Access is denied
400