This document provides a detailed guide on how to call the endpoint to send a phone verification code to the user. This endpoint is part of the user enrollment process and ensures that the user’s phone number is verified.
End-point overview #
URL:
https://auth-test.10npay.com/api/v1/User/phone-number/send-code
HTTP Method: POST
Headers:
accept: application/json
Authorization: Bearer {token}
Content-Type: application/json
Request Body:
id (int): The user ID.
phoneNumber (string): The phone number to verify.
Example Request
Bearer Token Example:
Bearer {Token}
Request Body Example:
{
"id": "174",
"phoneNumber": "+359879325037"
}
Curl Command Example:
curl -X 'POST' \ 'https://auth-test.10npay.com/api/v1/User/phone-number/send-code' \ -H 'accept: application/json' \ -H 'Authorization: Bearer {Token}' \ -H 'Content-Type: application/json' \ -d '{"id":"174","phoneNumber":"+359879325037"}'
Handling Responses
Success Response:
Status Code: 200 OK
Response Body:
{}
Error Responses:
User Not Found:
Status Code: 400 Bad Request
Response Body:
{
"errors": {
"Error": [
"UserNotFound"
]
},
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "Bad Request",
"status": 400,
"traceId": "00-5df08cec6503863e075181ccc300782e-0493bd78adc6be48-01"
}
Phone Number Already Registered #
Status Code: 400 Bad Request
Response Body:
{
"errors": {
"Error": [
"PhoneAlreadyRegistered"
]
},
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "Bad Request",
"status": 400,
"traceId": "00-2380381a9c9f1ac67f94757380cb86c2-67e03d531ef2355e-01"
}
Purpose of Sending Phone Verification Code #
The purpose of calling the https://auth-test.10npay.com/api/v1/User/phone-number/send-code endpoint is to send a verification code to the user’s phone number. This is a crucial step in the user enrollment process to ensure that the provided phone number is valid and belongs to the user.
Summary
Prepare the request with the appropriate headers, including the Bearer token for authorization.
Send the request using the specified endpoint and method, including the user ID and phone number in the request body.
Handle the response by checking the status code and response body. If successful, the verification code is sent to the user’s phone. If an error occurs, use the provided error messages to identify and resolve the issue.