Phone Number

Location /api/apps/{appID}/users/{accountType}:{address}/phone-number
This resource represents the phone number of the user.

Request Headers (Applies to all methods)

Authorization
header
Required: Yes

GET

/api/apps/{appID}/users/{accountType}:{address}/phone-number

Description

Get the phone number of the user.

Security

An Anonymous access is not allowed. This method can be accessed by the application administrator and the user himself. Other users can access the method if the application property "exposeFullUserDataToOthers" is set to true.

Headers
Name Required? type Description
Authorization Yes string Authorization header. OAuth2 Bearer token
Responses
200

Content-Type application/vnd.kii.PhoneNumberRetrievalResponse+json

The phone number has been retrieved successfully.
Contents
Name Type Description
phoneNumber string The phone number.
verified boolean The flag that indicates if the phone number is verified or not.
404

Content-Type application/vnd.kii.UserNotFoundException+json

The user was not found.
Contents
Name Type Description
errorCode string Error code "USER_NOT_FOUND".
message string The error message.
field string The field used for searching the user. This can be the userID or address field.
value string The field value used for searching the user.
appID string The ID of the application.
401

Content-Type application/vnd.kii.UnauthorizedAccessException+json

Not authorized to read the phone number of the user.
Contents
Name Type Description
errorCode string Error code "UNAUTHORIZED".
message string The error message.
authenticatedAppID string The authenticated appID.
authenticatedPrincipalID string The authenticated principal ID (userID or thingID).
404

Content-Type application/vnd.kii.UserWithoutAddressException+json

The user did not have phone number.
Contents
Name Type Description
errorCode string Error code "USER_ADDRESS_NOT_FOUND".
message string The error message.
userID string The ID of the user without address
appID string The ID of the application.

PUT

/api/apps/{appID}/users/{accountType}:{address}/phone-number

Description

Update the phone number of the user.

Security

This method can be performed by the administrator and by the user himself. Setting the parameter "verified" to true can be done only with the application administrator credentials.

Content-Type application/vnd.kii.PhoneNumberModificationRequest+json

The data for updating the phone number.

Headers
Name Required? type Description
Authorization Yes string Authorization header. OAuth2 Bearer token
Params
Name Required? Type Description
phoneNumber string The new phone number.
country string The country of the phone number.
verified boolean The flag that indicates if the new phone number is already verified or not.
Sample Request
{
  "phoneNumber": "[string]",
  "country": "[string]",
  "verified": "[boolean]"
}
Responses
204

Content-Type (None)

The phone number has been updated successfully.
Note This response has no contents.
404

Content-Type application/vnd.kii.UserNotFoundException+json

The user was not found.
Contents
Name Type Description
errorCode string Error code "USER_NOT_FOUND".
message string The error message.
field string The field used for searching the user. This can be the userID or address field.
value string The field value used for searching the user.
appID string The ID of the application.
401

Content-Type application/vnd.kii.UnauthorizedAccessException+json

Not authorized to update the phone number.
Contents
Name Type Description
errorCode string Error code "UNAUTHORIZED".
message string The error message.
authenticatedAppID string The authenticated appID.
authenticatedPrincipalID string The authenticated principal ID (userID or thingID).
409

Content-Type application/vnd.kii.AddressAlreadyInUseException+json

The phone number is already verified by another user.
Contents
Name Type Description
errorCode string Error code "USER_ALREADY_EXISTS".
message string The error message.
field string The field used to check the user already exists, can be "loginName", "emailAddress" or "phoneNumber".
value string The value of the field.
409

Content-Type application/vnd.kii.OperationNotAllowedException+json

The user did not have a password.
Contents
Name Type Description
errorCode string Error code "OPERATION_NOT_ALLOWED".
message string The error message.

DELETE

/api/apps/{appID}/users/{accountType}:{address}/phone-number

Description

Remove the phone number from the user.

Security

Can be performed by the administrator and the user himself.

Headers
Name Required? type Description
Authorization Yes string Authorization header. OAuth2 Bearer token
Responses
204

Content-Type (None)

The phone number has been removed successfully from the user.
Note This response has no contents.
404

Content-Type application/vnd.kii.UserNotFoundException+json

The user was not found.
Contents
Name Type Description
errorCode string Error code "USER_NOT_FOUND".
message string The error message.
field string The field used for searching the user. This can be the userID or address field.
value string The field value used for searching the user.
appID string The ID of the application.
401

Content-Type application/vnd.kii.UnauthorizedAccessException+json

Not authorized to remove the phone number.
Contents
Name Type Description
errorCode string Error code "UNAUTHORIZED".
message string The error message.
authenticatedAppID string The authenticated appID.
authenticatedPrincipalID string The authenticated principal ID (userID or thingID).