Users

This endpoint can be used to retrieve, create, update and remove users

Reference

GET /users/

Retrieve one or more users associated with this client

POST /users/

Create a new user

PUT /users/

Update an existing user

DELETE /users/<userId>

Remove a user. When no advertisement-data is associated with the supplied user, the user account will be completely removed from the database. When there are advertisements and/or transactions available: all personal data will be anonymized. Please be aware: this process is irreversible!

General search parameters

field type description/constraints Req W U
useCache boolean Use API caching module No No No
page int Show page x from resultset (default: 1) No No No
itemsPerPage int Number of items per page.
Minimum: 1 item.
Maximum 100 items
(default: 25)
No No No


Fields

field type constraints Req W U S
userId int No No No Yes
clientId int The clientId by which this user was created. Empty value means: created manually
Only editable for clients with internal features enabled
No Yes Yes No
externalUserId int The unique userId in the client’s backend
Only editable for clients with internal features enabled
Yes Yes Yes No
contacts object The users contacts No No No No
companyName string The company name2 - 255 characters
Either field companyName or lastName is mandatory
Yes/No Yes Yes No
gender string(1) Available options: No No No No
- M
- F
firstName string 2 - 255 characters No Yes Yes No
lastName string 2 - 255 characters Yes Yes Yes No
dateOfBirth date Format: yyyy-mm-dd No Yes Yes No
address string 2 - 255 characters No Yes Yes No
houseNumber string max 20 characters No Yes Yes No
postalCode string A valid Dutch postal codeNot mandatory when the user is abroad. See also: county and country No Yes Yes No
city string 2 - 255 characters No Yes Yes No
county string Available options: No Yes Yes No
- DR
- FL
- FR
- GE
- GR
- LI
- NB
- NH
- OV
- UT
- ZE
- ZH
Leave empty when user is not in the Netherlands
country string Available options: Yes Yes Yes No
- NL (Default)
Leave empty when user is not in the Netherlands
email string a valid email-address Yes Yes Yes No
website string No Yes Yes No
phone string min 5 charactersmax 50 characterseither a phonenumber or cellular number must be specified Yes Yes Yes No
fax string min 5 charactersmax 50 characters No Yes Yes No
cellular string min 5 charactersmax 50 characterseither a phone number or cellular number must be specified Yes Yes Yes No
activation object When creating a new user, an activation object  will be returned in order to unlock/activate the user.
See also chapter: User Activation
No No No No


Fields contacts object

field type constraints Req W U S
numberOfContacts int The number of contacts available No No No No
numberOfActiveContacts int The number of contacts available currently used with active advertisements No No No No
contacts array list of contacts No No No No


Fields activation object

field type constraints Req W U S
activationtoken string A unique token for use with the User Activation No No No No
validUntil datetime The expiration-date of this token No No No No


Example retrieving Users

Request

GET /rest/v1/users/?useCache=0&page=1&itemsPerPage=10 HTTP/2

or

GET /rest/v1/users/1/ HTTP/2

Response

{
 "result": true,
 "fromCache": false,
 "totalItems": 4,
 "totalInSet": 100,
 "page": 1,
 "itemsPerPage": 10,
 "speed": 0.0010221004486084,
 "data": [
   {
     "userId": "1",
     "clientId": "1",
     "externalUserId": "1",
     "companyName": "test company",
     "firstName": "first name",
     "lastName": "last name",
     "gender": "M",
     "dateOfBirth": "1970-06-18",
     "address": "streetname",
     "houseNumber": "no",
     "postalCode": "1111 AA",
     "city": "Amsterdam",
     "county": "NH",
     "country": "NL",
     "email": "info@test.nl",
     "website": "www.test.nl",
     "phone": "020-1234567",
     "fax": "",
     "cellular": ""
   },
   ]
}


Example creating User

Request

POST /rest/v1/users/ HTTP/2
{
 "clientId": 1,
 "externalUserId": 1,
 "companyName": "Bedrijfsnaam",
 "gender": "M",
 "firstName": "Voornaam",
 "lastName": "Achternaam",
 "dateOfBirth": "1980-04-09",
 "address": "Straatnaam",
 "houseNumber": "19b",
 "postalCode": "2818 AA",
 "city": "Zoetermeer",
 "county": "ZH",
 "country": "NL",
 "email": "info@test.nl",
 "website": "www.test.nl",
 "phone": "079-1234567",
 "fax": "",
 "cellular": "06-12345678"
}

Response

{
 "result": true,
 "errors": "",
 "data": {
   "userId": "19569",
   "clientId": "0",
   "externalUserId": "0",
   "companyName": "Bedrijfsnaam",
   "firstName": "Voornaam",
   "lastName": "Achternaam",
   "gender": "M",
   "dateOfBirth": "1980-04-09",
   "address": "Straatnaam",
   "houseNumber": "19b",
   "postalCode": "2818 AA",
   "city": "Zoetermeer",
   "county": "",
   "country": "NL",
   "email": "info@test.nl",
   "website": "www.test.nl",
   "phone": "079-1234567",
   "fax": "",
   "cellular": "06-12345678",
   "activation": {
     "activationtoken": "24e53f0a35303b3aeb...8481c9d9fea83a28aa6",
     "validUntil": "2021-12-02 12:05:10"
   }
}


Example removing a user

Request

DELETE /rest/v1/users/1/ HTTP/2

Response

{
  "result": true,
  "errors": [],
  "data": false
}

or

Request

DELETE /rest/v1/users/ HTTP/2
{
    "userId": 1,
    "ip": "127.0.0.2"
}

Response

{
  "result": true,
  "errors": [],
  "data": false
}