API: User

Me

JWT Authorisation

GET /api/v3/user/me

Request parameter:

No Request parameter

Response data:

ParameterTypeDescription
contactarrayAn array containing API: Contact information 
contact[id]integerContact-ID of the user
contact[type]integer1=Company / 2=Person
contact[name1]stringLastname / Company name of the user
contact[name2]stringFirstname / Company addition of the user
contact[mail]string|nullEmail address of the user
contact[letter_text]stringLetter text of the user
contact[language]"de"|"fr"|"it"|"en"|nullLanguage of the user
contact[avatar]string|nullA base64 encoded contact avatar
loginarrayAn array containing login information
login[id]integerLogin-ID of the user
login[username]stringUsername of the user
login[2fa]booleanIndicator if 2FA is active
login[is_admin]booleanIndicator if the user is an "admin"
login[is_sharer]booleanIndicator if the user is a sharer, if so contacts that are not leds, not deleted or archived and have contact.id as sharer set up , will be included in login permission list
sharer_idinteger|nullContact-ID of the sharer
point_of_contactarrayClient login point of contact API: User
point_of_contact[id]int|nullPoint of contact id (BS: User id)
point_of_contact[first_name]string|nullFirst name
point_of_contact[last_name]string|nullLast name
point_of_contact[phone]string|nullPhone number 
point_of_contact[phone_mobile]string|nullMobile phone number
point_of_contact[email]string|nullEmail adress
point_of_contact[avatar]string|nullA base64 encoded user avatar
point_of_contact[name]string|null

Name

point_of_contact[type]idType of point of contact (0=Client Advisor, 1=Manager, 2=Consultant)

Response (Error):

ParameterTypeDescription
codeintegerAn error code
errorstringA message containing some information about the error 
Request
curl -X GET https://public.brokerstar.biz/api/v3/user/me --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'


Response (Success)
200 OK
{
    "data": {
        "contact": {
            "id": 31,
            "type": 2,
            "name1": "Abels",
            "name2": "Conrad",
            "mail": "conrad@mustermann.ch",
            "letter_text": "Sehr geehrter Herr Abels",
            "language": "de",
            "avatar": null
        },
        "login": {
            "id": 2,
            "username": "demo-de",
            "2fa": false,
            "is_admin": false,
            "is_sharer": false
        },
        "sharer_id": null,
		"point_of_contact": {
            "id": 7,
            "first_name": "Akali",
            "last_name": "Baba",
			"phone": "+22 12312312112",
			"phone_mobile": "+22 321312311",
			"email": "akali.baba@gmail.com",
			"avatar": "data:image/gif;base64,/9j/4AAQSk...S4wICh1c2..",
            "name": "Akali Baba",
            "type": 0
        },
    }
}


Response (Error)
401 Unauthorized
{
    "code": 401
	"message": "Invalid JWT Token"
}

Change my data


Preconditions

User needs to be logged in into account that He want to change login data.


POST /api/v3/user/me

Request parameter:

ParameterMandatoryIn TypeDescription
loginnostring(80)New login (unique)
emailnostring(255)New email

Response data:

Metadata: object.

ParameterTypeDescription
messagestringResponse message
codeintResponse status code (same as in http code)


Response (Error):

ParameterTypeDescription
codeintegerAn error code
errorstringA message containing some information about the error 
errorsarrayList of errors devided by field in associative array {field_name:error message}
Request
curl -X GET https://public.brokerstar.biz/api/v3/user/me  -d '{
    "login": "mat",
    "email": "mat@wmc.ch",
}'  --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'


Response (Success)
200 OK {
    "message": "Login data changed"
}


Response (Error)
400 Bad request
{
    "code": 400,
	"errors": "Invalid input data",
	"errors"" {
		"login": "Login is already in use, please select other login"
	}
}

Or one of 

Change-Password


Preconditions

User needs to be logged in into account that He want to change password to.


POST /api/v3/user/change-password

Request parameter:

ParameterMandatoryIn TypeDescription
current_passwordyesstring(80)Current user password
passwordyesstring(80)New requested user password (min 5 charts)

Response data:

Metadata: object.

ParameterTypeDescription
messagestringResponse message
codeintResponse status code (same as in http code)


Response (Error):

ParameterTypeDescription
codeintegerAn error code
errorstringA message containing some information about the error 
errorsarrayList of errors devided by field in associative array {field_name:error message}
Request
curl -X GET https://public.brokerstar.biz/api/v3/user/change-password  -d '{
    "current_password": "god",
    "password": "IL0V3#Secur!tySoIGotSerious6A**word",
}'  --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'


Response (Success)
200 OK {
    "message": "Password changed"
}


Response (Error)
401 Unauthorized
{
    "code": 401
	"message": "Invalid password"
}

Or one of 

Reset-Password

No authorization 

POST /api/v3/user/reset-password

Request parameter:

ParameterMandatoryIn TypeDescriptionChanges
mail


ONE OF

string(100)Contact mail address
loginstring(5->80)Contact login
codenostring(1)Set Value to "1" if only a code should be send to the user, else ommit this parameter
client_urlnostringBase url for reset password link
passwordyesstring(5->80)Contact passwordRemoved, no longer needed
mail_subjectyesstring(1->150)Reset password email subjectRemoved, no longer needed
mail_fromyesstring(email)From/reply emailRemoved, now taken from BrokerStar mail setup.
mail_templateyesstring(20->)Reset password email body template
Placeholders:
  • %code% - confirmation code
  • %expire% - code expiration date
Removed, no longer needed

Response data:


ParameterTypeDescription
messagestringResponse message
data[mail]stringMail that was target for password reset
data[login]stringLogin of user that password will be reseted
statusintResponse status code (same as in http code)


Response (Error):

ParameterTypeDescription
codeintegerAn error code
errorstringA message containing some information about the error 
errorsarrayList of errors devided by field in associative array {field_name:error message}
Request
curl -X GET https://public.brokerstar.biz/api/v3/user/reset-password  -d '{{
    "login":"my-user-name"
}' 


Response (Success)
200 OK 
{
    "message": "Password change email was send to contact@my-mail.com",
    "status": 200
}


Response (Error)
404 Not found
{
    "code": 404
	"message": "User with mail/login not found"
}
Response (Error)
424 Failed dependency
{
    "code": 424
	"message": "Login has no mail set up, will not send email"
}
Response (Error)
400 Bad request
{
    "code": 400
	"message": "To reset password You need to provide login or mail argument"
}

Or one of 

Reset-Password Confirm

No authorization 

POST /api/v3/user/confirm-reset-password

Request parameter:

ParameterMandatoryIn TypeDescription
mail


ONE OF

string(100)Contact mail address
loginstring(5->80)Contact login
codeyesstring(5->80)

Verification code

passwordyesstringThe new user password

Response data:


ParameterTypeDescription
codeintResponse code
messagestringResponse message


Response (Error):

ParameterTypeDescription
codeintegerAn error code
errorstringA message containing some information about the error 
errorsarrayList of errors devided by field in associative array {field_name:error message}
Request
curl -X GET https://public.brokerstar.biz/api/v3/user/confirm-reset-password  -d '{{
    "login":"my-user-name",
    "code":"A12-B23C-5E6",
	"password":"Ch4nge_me!"
}' 


Response (Success)
200 OK 
{
   "code": 200 
   "message": "Password changed"
}


Response (Error)
404 Not found
{
    "code": 404
	"message": "User with mail/login not found"
}
Response (Error)
400 Bad request
{
    "code": 400
	"message": "Incorrect code"
}
Response (Error)
400 Bad request
{
    "code": 400
	"message": "Expired code (2021-11-12 12:30:11), please re-send email with new code"
}

Or one of 

Register

No authorization 

POST /api/v3/user/register

Request parameter:

ParameterMandatoryIn TypeDescription
API: Contact :  All fields from single contact
name_1yesstring(255)Company name or personal contact first name
name_2yesstring(255)Company addiction or personal contact last name
mailyesstring(100)Contact mail address
contact_typeyesint(1|2)Company=1,Personal=2
birthdayyes (for contact_type=2)string(date)Contact(person)  b-day date 
formation_datenostring(date)Contact (company) establish date
loginyesstring(5->80)Contact login
passwordyesstring(5->80)Contact password
invitation_codenostring(2->40)If set will try to set an intermediary based on the invitation code.`
usernointId of Client Advisor (default 1)
addressnostring(255)Contact address
post_codenostring(30)Contact postcode
citynostring(50)Contact city
mobilenostring(100)Contact mobile number
contact_groupyesstringString IDs comma separated (ex: "1,2,3")
countrynointContact country (default 1:Switzerland)
languagenointContact language (default 1:German)
Additional setup
_sendMailnoboolDefault = false, If true - if success maill will be send to contact and to related advisors.

Response data:


ParameterTypeDescription
dataarrayResponse message
data[id]intId of created contact
statusintResponse status code (same as in http code)


Response (Error):

ParameterTypeDescription
codeintegerAn error code
errorstringA message containing some information about the error 
errorsarrayList of errors devided by field in associative array {field_name:error message}
Request
curl -X GET https://public.brokerstar.biz/api/v3/user/register  -d '{
    "name_1":"Name",
    "name_2":"Surname",
    "birthday":"1984-07-07",
    "contact_type":1,
    "login": "username",
    "password": "0j124kas<Asd_)AI",
	"user": 2
    "address":"Baslerstrasse 1",
    "post_code":"4055",
    "city":"Basel",
    "mobile":"077 123 54 86",
    "mail":"gugus@test.ch",
	"contact_group":"3,4"
}' 
Response (Success)
200 OK 
{
    "data": {
        "id": 17685
    },
    "status": 200
}
Response (Error)
400 Bad Request 
{
    "error": "Contact already exist in db",
    "code": 400
}
Response (Error)
400 Bad Request 
{
    "error": "Please select different login name",
    "code": 400
}

Related pages