Update Specific User in Company API
Require Authentication
This API is used to update specific user information in the company based on combination of deviceID and token.
Only users that have module "user_and_roles_menu" and "manage_user" in their role/department (currently only Administrator) can update user
departmentID and "active" state can not be changed for company owner user (first user registered in the system who create the company).
URL
api/companies/updateuser/:userID
Required parameter (in URL)
- :userID «contains userID that want to be updated. It must be put in the URL, e.g: api/companies/updateuser/2»
Required parameter (POST)
- deviceID
- token
Optional parameter (POST)
- departmentID «departmentID for this new user. Value must be exist in database. To get the departmentID, please see Get Available Department / Roles»
- firstName «contains user first name»
- password «contains minimum 5 characters. Only used to change the password»
- retype_password «value must be the same as password»
- lastName
- phone
- mobile
- active «indicate if user is can login or not. Value must be "Y" or "N". Default value if left empty: "Y"»
Example JSON Payload
{ "deviceID": "ABCD-EFGH-IJKL-MNOP", "token": "bb602ab13b8090268cd6e3bb9dfa39e2", "mobile": "+6281233456789" }
Possible return HTTP status code
- 200
- 400
- 401
- 404
- 405
Return message
{ "status": "success", "message": { "profile": { "userID": 90, "username": "support@superfy.com", "firstName": "Support", "lastName": "Support", "phone": "123456789", "mobile": "+628111111111", "profilePicture": "https://wasteinsights-files.s3.ap-southeast-2.amazonaws.com/uploads/profilepicture/90/7e7383c6495504d071b04977bad92e8a.png?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=1234567890ABCDEFGHIJ%2F20230817%2Fap-southeast-2%2Fs3%2Faws4_request&X-Amz-Date=20230817T075119Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=123456789009876543214c286c6e40b37a46e04525cb28368990e206d741f216", "createdDate": 1521442184, "active": "Y", "timezoneOffset": 420, "timezoneName": "Asia/Jakarta", "isEmailVerified": "Y", "departmentID": 46, "departmentName": "Administrator" }, "company": { "companyID": 16, "companyName": "Smartsensor Live Testing", "companyLogoURL": "https://wasteinsights-public-files.s3.ap-southeast-2.amazonaws.com/images/icon_placeholder_logo_company.jpg", "companyAddress1": "3/441 Nudgee Road", "companyAddress2": "", "companyCity": "Hendra", "companyState": "QLD", "companyCountry": "AU", "companyZipCode": "4011", "companyLatitude": -27.415924072266, "companyLongitude": 153.07464599609, "companyPhone": "", "companyFax": "", "companyWebsite": "", "expiredDate": 0, "default_currencyCode": "AUD", "default_paymentPeriod": "monthly", "fillLevelSource": "laseravg", "collectionCalculationConfig": "standard", "bulkCollectionRadius": "2000", "licenseTypeID": 1, "licenseTypeName": "Town Plan" } } }
Note:
"timezoneOffset" contains user time differences to UTC in minutes. For example, if it is 420, it means that it is UTC +7 hour (420 minutes / 60 minutes × 1 hour = 7 hour)
"timezoneName" contains user timezone name as mentioned in http://php.net/manual/en/timezones.php