Link Search Menu Expand Document

Altering a user

Returns an OK code and a JSON for the user. A sample is shown below:

{
  "result": {
      "code": 1,
      "status": "ok"
  },
  "results": {
      "user_info": {
          "id": 123123,
          "user_id": 123123,
          "authentication_point_identifier": "10555454555",
          "auxiliary_identifier": "peba4318xel",
          "first_name": "Foo",
          "last_name": "Bar",
          "country_code": "NL",
          "address_streetname": "Herengracht",
          "address_housenumber": "504",
          "address_housenumber_extension": "II",
          "address_line_2": "Grachtengordel",
          "address_line_3": "Centrum",
          "address_towncity": "Amsterdam",
          "address_regionstate": "Noord-Holland",
          "address_postalcode": "1017 CB",
          "lang_code": "en",
          "gender": "F",
          "birthday": "1986-01-30T00:00:00+00:00",
          "username": "foo@bar.com",
          "phone_number": "+31-220445641",
          "member_number": "178546",
          "language": "nl-BE",
          "opt_in_secondary": false,
          "user_facebook_id": "321321",
          "user_facebook_access_token": "dAw2ISsd6asd67ASDLBJKd...",
          "mailing_list": {
              "mailing_list_sub_offered": true,
              "mailing_list_subscribed": false,
              "printed_mailing_list_subscribed": true
          },
          "entity_code": null,
          "opt_in_programme": {
              "programme_opted_in": true,
              "join_date": "2019-06-06T08:06:14+00:00"
          },
          "signup_store": {
              "signup_store_id": 1383,
              "signup_store_name": "ACME Inc"
              },
          "home_store": {
              "home_store_id": 2774,
              "home_store_name": "Herengracht HQ"
          },
          "registered": true,
          "is_employee": true
          "user_type": "registered",
          "loyalty_status": {
              "campaign_id": 2095,
              "name": "Level 1",
              "description": "Level 1 in the Programme",
              "loyalty_level_id": 2,
              "points_to_proceed_next_level": 500,
              "points_to_remain_current_level": 220,
              "maintenance_points_level": 200,
              "last_review_date": "2019-04-04T00:05:22+00:00",
              "next_review_date": "2020-04-04T00:05:22+00:00",
              "date_reached": "2019-06-06T08:06:14+00:00"
          }
      },
      "result_type": "alter-user"
  }
}

Overview

  • Call name: alter-user
  • Endpoint URL: https://api0.spaaza.com/internal/alter-user
  • Request methods: PUT
  • Request Content-Type: multipart/form-data or application/x-www-form-urlencoded
  • Response Content-Type: application/json
  • Auth required: yes
  • X-MyPrice-App-Hostname header requirement: mandatory when using privileged authentication

Introduction

This API call modifies information about an existing user.

HTTP Parameters

The following HTTP parameters can be passed to the API:

Parameter Description
address_housenumber (string, optional) The street number or house name of the user’s postal address.
address_housenumber_extension (string, optional) The extension of the street number of the user’s postal address, for example “Apartment 21”
address_line_2 (string, optional) The second line of the user’s postal address, which can be used to denote e.g. a neighbourhood or village.
address_line_3 (string, optional) The third line of the user’s postal address, which can be used to denote e.g. a village or borough
address_postalcode (string, optional) The user’s postal or zipcode.
address_regionstate (string, optional) The region or state of the user’s postal address.
address_streetname (string, optional) The street name of the user’s postal address.
address_towncity (string, optional) The user’s postal city.
authentication_point_identifier (string, optional) The id of the user in a third-party identity system such as a webstore. Highly recommended in the case that e.g. an update to the member’s email address will be made by the source of identity if that source is not Spaaza - in this case the authentication_point_identifier can be used as a unique identifier for the customer.
auxiliary_identifier (string, optional) An auxiliary identifier string used by the retailer or other organisation. This value is returned in displays and is searchable in Spaaza analytics, but is not generally used as a primary identifier in API endpoints.
birthday (string, mandatory or optional depending on the setup of the member programme) The birth date of the user. ISO 8601 (YYYY-MM-DD) or ISO 8601 extended (e.g. 1983-07-27T00:00:00+00:00 or 1983-07-27T00:00:00Z) are the default allowed formats. Dates in other formats (“D/M/YYYY”, “DD/MM/YYYY”, “D-M-YYYY” and “DD-MM-YYYY” can be used instead - see the birthday_field_format parameter). If the birthday parameter is supplied in ISO 8601 extended format any timezone offset will be converted to UTC.
birthday_field_format (string, mandatory if supplying birthday parameter in a format other than ISO 8601 or ISO 8601 extended) The format of the birthday parameter supplied if not in ISO 8601 or ISO 8601 extended format. Allowed values are “DD-MM-YYYY”, “D-M-YYYY”, “DD/MM/YYYY” and “D/M/YYYY”. Any other value implies ISO 8601/ISO 8601 extended format.
branch_business_owner_code (string, optional) A retailer-specific branch code used by the retailer to identify the individual branch in a chain in which the new account is being created, if it is being created in a branch. If the store_id value is also supplied, then store_id takes precedence. In order to use the branch_business_owner_code field there must be a record of the branch code in the Spaaza database.
chain_id (integer, mandatory when using admin authentication) The id of the chain (retailer) to which the user is connected.
country_code (string, optional) The ISO ALPHA-2 country code of the user.
first_name (string, optional) The first name of the user.
gender (string, optional) The gender of the user. Allowed values are M and F in either upper or lower case.
home_store_id (integer, optional) Home store id in the Spaaza system for which the new account was created
language (string, optional) The preferred IETF BCP 47 language code (eg. en-GB, nl, nl-BE, etc.) for a user. The language code should consist of an ISO 639 language tag (e.g. nl) followed by optional subtags (e.g. BE), using hyphens as separators, for example nl-BE.
last_name (string, mandatory unless the user is being added on the basis of their Facebook account details) The last name of the user.
mailing_list_sub_offered (boolean, optional) Whether a subscription to the mailing list was offered to the user. If this parameter is not supplied a default value of false is applied.
mailing_list_subscribed (boolean, optional) Whether the user is subscribed to the mailing list. If this parameter is not supplied a default value of false is applied.
member_number (string, optional) The unique membership number or code for the shopper within the membership or loyalty programme. In most cases this is numeric, but string values are allowed. It is only possible to alter the member_number parameter using privileged authentication or admin authentication with write permissions for the chain associated with the user.
opt_in_secondary (boolean, optional) Generic opt in field to be used by the retailers, for recording opt ins that the standard fields don’t allow.
password (string, optional) The password of the user. In some systems it is not possible to update the customer password in remote authentication systems via the Spaaza API.
phone_number (string, optional) The contact number for a user.
printed_mailing_list_subscribed (boolean) Whether the user is subscribed to the mailing list for printed mail such as catalogues.
programme_opted_in (boolean) The programme subscription status of the user. Note that if this chain requires a user to be opted into a programme, the programme will only work for the user if this is set to true.
registered (boolean, optional) Whether the user is registered. The definition of the term ‘registered’ is flexible. The default value if this parameter is not supplied is true.
is_employee (boolean, optional) Whether the user is an employee of a chain. The defualt value if this paramter is not supplied is false.
store_id (integer, optional) Spaaza ID of the branch in which the new account was created, assuming it was created in a branch.
user_id (integer, mandatory when not using username, member_number or authentication_point_identifier to identify the user) The ID of the user whose details are to be altered. This parameter can be used to identify the user. If this parameter is used to identify the user, the parameters username or authentication_point_identifier should not be used to identify the user, and will be altered if supplied and different from current values.*
username (string, mandatory when not using member_number, user_id or authentication_point_identifier to identify the user) The username of the user in email address format. This parameter can be used to identify the user. If this parameter is used to identify the user, the parameter authentication_point_identifier cannot be supplied to identify the user. In the case of admin authentication, this parameter cannot be used to identify the user.

* In the case of admin authentication, the user whose details are to be altered must be identified by at least one of the parameters user_id, username or authentication_point_identifier.

Note that, in order to remove values such as ‘address_housenumber_extension’ from a user record, it is necessary to send their parameters as empty values.

Permissions and Authentication

Admin authentication: The performing user needs to be logged in and have assign 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.