Save User Contacts API Documentation

Overview

The Save User Contacts API allows developers to save multiple user contact details in the system. This API accepts a variety of user-related data, including personal information and group categorization. This endpoint is designed for systems that require bulk or single-entry contact management capabilities.

Thank you for reading this post, don't forget to subscribe!

Endpoint

POST https://webapi.whatso.net/api/UnAuthorized/save-user-contacts

Request Headers

Header Value Description
Content-Type application/json Indicates the media type of the resource.
Accept application/json Media type(s) that is/are acceptable for the response.

Request Body Parameters

The request body must be a JSON object containing the following fields:

Field Type Required Description
userName String Yes Username of the account.
password String Yes Password for the account.
firstName String Yes User’s first name.
middleName String No User’s middle name.
lastName String Yes User’s last name.
mobileNumber String Yes User’s mobile phone number.
emailId String No User’s email address.
birthDate String No User’s birth date in YYYY-MM-DD format.
weddingDate String No User’s wedding date in YYYY-MM-DD format.
anniversaryDate String No User’s anniversary date in YYYY-MM-DD format.
address String No User’s physical address.
city String No City of the user’s address.
state String No State of the user’s address.
country String No Country of the user’s address.
zipCode String No Postal code of the user’s address.
column1 to column5 String No Custom fields for additional information.
groupName String No Group name to categorize the contact.

Response

The API response will be a JSON object containing the results of the operation. The structure of the response JSON will be determined by the parsing and processing done in the callback function.

Example Request

const requestOptions = {
url: ‘https://webapi.whatso.net/api/UnAuthorized/save-user-contacts’,
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’,
‘Accept’: ‘application/json’
},
body: JSON.stringify({
userName: ‘exampleUser’,
password: ‘examplePass’,
firstName: ‘John’,
lastName: ‘Doe’,
mobileNumber: ‘1234567890’,
emailId: ‘john.doe@example.com’,
birthDate: ‘1990-01-01’,
address: ‘1234 Main St’,
city: ‘Anytown’,
state: ‘Anystate’,
country: ‘USA’,
zipCode: ‘12345’
})
};

fetch(requestOptions.url, requestOptions)
.then(response => response.json())
.then(data => console.log(data));

Error Handling

The API should properly handle and return meaningful error messages in case of failure. Common HTTP status codes like 400 (Bad Request), 401 (Unauthorized), and 500 (Internal Server Error) should be appropriately used to convey the nature of the error.

Security Considerations

Since this API involves sensitive user information and authentication details, it is imperative to ensure that all data transmissions are secured using HTTPS. Additionally, proper validation and sanitization of all input fields should be implemented to prevent injection attacks and other security vulnerabilities.