Adding and updating users
This API allow to add new users and update existing user's data.
Add new user
POST Users/User
Request creates new user and adds it to your company user's list.
Body parameters
Name | Type | Description |
---|---|---|
email |
string |
Required. User email address. |
homeClubId |
long |
Required. User home club identifier. |
registeredAtClubId |
long |
Club's identifier where user is registered. When undefined takes homeClubId value. |
birthDate |
string |
Required. User birth date. |
personalId |
string |
User personal identifier. |
firstName |
string |
User first name. |
lastName |
string |
User last name. |
phoneNumber |
string |
User phone number. |
idCardName |
string |
User identity card name. |
idCardNumber |
string |
User identity card number. |
legalGuardian |
LegalGuardian | User legal guardian. |
isForeigner |
bool |
Indicates if user is a forigner. |
sex |
string |
User sex. Possible values:
|
address |
Address | User address. |
isGuest |
bool |
Indicates if user is a guest without contract, not a permanent club member. |
Response
User details if operation is successful, or collection of errors with add user error codes otherwise.
Example request
In this example we add new user with some sample data to the company user's list.
curl -X POST -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d '{ "firstName": "John", "lastName": "Fibo", "email": "john.fibo@perfectgym.pl", "phoneNumber": "0048123456789", "idCardName": "Passport", "idCardNumber": "ABC 123456", "legalGuardian": "", "birthDate": "1978-06-01T00:00:00", "isForeigner": false, "sex": "Male", "homeClubId": 12, "address": { "line1": "al. Jerozolimskie 114", "line2": "", "city": "Warszawa", "postalCode": "20-259", "countrySymbol": "PL" } }' http://yoursubdomain.perfectgym.com/Api/Users/User
Example response
Status: 200 OK
{
"elements": [
{
"id": 236,
"timestamp": 447937,
"personalId": "80010101234",
"number": "2b7b02df-08ae-4720-a3ce-a594bfc46d47",
"cardNumber": "",
"firstName": "John",
"lastName": "Fibo",
"email": "john.fibo@perfectgym.pl",
"emailAddressIsConfirmed": false,
"phoneNumber": "0048123456789",
"idCardName": "Passport",
"idCardNumber": "ABC 123456",
"legalGuardian": "",
"photoUrl": "",
"coverPhotoUrl": "",
"birthDate": "1978-06-01T00:00:00",
"isForeigner": false,
"sex": "Male",
"newsletterAgreement": false,
"termsAndConditionsAgreement": false,
"address": {
"country": "Poland",
"city": "Warszawa",
"postalCode": "20-259",
"line1": "al. Jerozolimskie 114",
"line2": ""
},
"directDebit": {
"accountNumber": "",
"ownerName": "",
"street": "",
"cityAndPostalCode": "",
"documentUrl": ""
},
"homeClubId": 12,
"registeredAtClubId": "",
"isActive": true,
"isDeleted": false,
"contracts": [
]
}
]
}
Example error response
Subsequent user add request with same samlpe data generates following error:
Status: 400 Bad Request
{
"errors": [
{
"code": "UserAlreadyExist",
"property": "Email",
"message": ""
}
]
}
Update existing user
PUT Users/User
Request updates existing user's data.
Employee mode parameters
Name | Type | Description |
---|---|---|
userId |
long |
User's identifier. |
User mode parameters
Request in user mode has no parameters. Request updates authentificated user.
Body parameters
You should pass only parameters that acctualy needs to be updated. Null
parameters are discarded.
Name | Type | Description |
---|---|---|
personalId |
string |
Must be unique. User personal identifier. |
firstName |
string |
User first name. |
lastName |
string |
User last name. |
email |
string |
Must be unique. User email address. |
phoneNumber |
string |
Must be unique. User phone number. |
idCardName |
string |
User identity card name. |
idCardNumber |
string |
User identity card number. |
legalGuardian |
LegalGuardian | User legal guardian. If object is not null, then the new legal guardian will be created and the old one will be marked as obsolete. So this object should be passed with all fields filled. |
birthDate |
string |
User birth date. |
isForigner |
bool |
Indicates if user is a forigner. |
showActivityInClub |
bool |
Indicates if user wants to be included in list of user signed up for classes or users present in club. For details see Who is in class or Who is in club. |
sex |
string |
User sex. Possible values:
|
address |
Address | User address. |
paymentPrimarySource |
string |
Payment source value - 'CreditCard', 'DirectDebit', 'Cash'. |
Response
User details if operation is successful, or collection of errors with update user error codes otherwise.
Example request
In this example we update user's address.
curl -X PUT -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d '{ "address": { "line1": "ul. Przyczolkowa 334", "line2": "", "city": "Warszawa", "postalCode": "02-962", "countrySymbol": "PL" } }' http://yoursubdomain.perfectgym.com/Api/Users/User?userId=236
Example response
Status: 200 OK
{
"elements": [
{
"id": 236,
"timestamp": 448035,
"personalId": "80010101234",
"number": "2b7b02df-08ae-4720-a3ce-a594bfc46d47",
"cardNumber": "",
"firstName": "John",
"lastName": "Fibo",
"email": "john.fibo@perfectgym.pl",
"emailAddressIsConfirmed": false,
"phoneNumber": "0048123456789",
"idCardName": "Passport",
"idCardNumber": "ABC 123456",
"legalGuardian": "",
"photoUrl": "",
"coverPhotoUrl": "",
"birthDate": "1978-06-01T00:00:00",
"isForeigner": false,
"sex": "Male",
"newsletterAgreement": false,
"termsAndConditionsAgreement": false,
"address": {
"country": "Poland",
"city": "Warszawa",
"postalCode": "02-962",
"line1": "ul. Przyczolkowa 334",
"line2": ""
},
"directDebit": {
"accountNumber": "",
"ownerName": "",
"street": "",
"cityAndPostalCode": "",
"documentUrl": ""
},
"homeClubId": 12,
"registeredAtClubId": "",
"isActive": true,
"isDeleted": false,
"contracts": [
]
}
]
}
Example error response
User update request with non existant user identifier
Status: 400 Bad Request
{
"errors": [
{
"code": "UserDoesNotExists",
"property": "",
"message": ""
}
]
}
Confirm user email address
GET Users/ConfirmEmailAddress
Parameters
Name | Type | Description |
---|---|---|
token |
string |
Required. Token. |
Response
Returns User details when confirm email addres for given token, otherwise, it returns InvalidToken error.
Example request
In this example user's password reset token.
curl -X GET -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" http://yoursubdomain.perfectgym.com/Api/Users/ConfirmEmailAddress?token=a012345678901234567890123456789b
Example response
Status: 200 OK
{
"elements": [
{
"id": 236,
"timestamp": 448035,
"personalId": "80010101234",
"number": "2b7b02df-08ae-4720-a3ce-a594bfc46d47",
"cardNumber": "",
"firstName": "John",
"lastName": "Fibo",
"email": "john.fibo@perfectgym.pl",
"emailAddressIsConfirmed": true,
"phoneNumber": "0048123456789",
"idCardName": "Passport",
"idCardNumber": "ABC 123456",
"legalGuardian": "",
"photoUrl": "",
"coverPhotoUrl": "",
"birthDate": "1978-06-01T00:00:00",
"isForeigner": false,
"sex": "Male",
"newsletterAgreement": false,
"termsAndConditionsAgreement": false,
"address": {
"country": "Poland",
"city": "Warszawa",
"postalCode": "02-962",
"line1": "ul. Przyczolkowa 334",
"line2": ""
},
"directDebit": {
"accountNumber": "",
"ownerName": "",
"street": "",
"cityAndPostalCode": "",
"documentUrl": ""
},
"homeClubId": 12,
"registeredAtClubId": "",
"isActive": true,
"isDeleted": false,
"contracts": [
]
}
]
}
Example error response
The token is invalid, is not assigned to any email address.
Status: 400 Bad Request
{
"errors": [
{
"code": "InvalidToken",
"property": "",
"message": ""
}
]
}