Check Company Username Availability
An overview of the Check Company Username Availability endpoint.
Endpoint Description
The "Check Company Username Availability" endpoint provides the capability to verify if a desired username is available within a specific company on the R1 Discover platform. This allows for the integration of company-specific usernames, ensuring they are unique within the company and possibly synchronized with external system IDs.
HTTP Method:
GET: /api/v1/users/check-username/company/{companyId}/{username}
Headers:
Content-Type:
application/json— Specifies that the request body is formatted as JSON.Accept:
application/json— Indicates that the client expects a response in JSON format.Authorization:
Bearer {token}— A valid authentication token is required to access this endpoint.
URL Parameters:
companyId (integer): The unique identifier of the company within R1 Discover.
username (string): The desired username to check for availability within the specified company.
Request Examples
curl --request GET \
--get "https://api.r1learning.com/api/v1/users/check-username/company/1/xyz123" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "Authorization: Bearer {token}"const url = new URL(
"https://api.r1learning.com/api/v1/users/check-username/company/1/xyz123"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer {token}",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.r1learning.com/api/v1/users/check-username/company/1/xyz123");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer ••••••");
var content = new StringContent(string.Empty);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());Response Examples
{
"error": 0,
"message": "Username 'johndoe123' is available for this company"
}{
"error": 0,
"message": "Username 'johndoe123' is available taken for this company"
}{
"error": 1,
"message": "Invalid username format"
}Notes
Authorization Required: Ensure the provided Bearer token is valid and has sufficient privileges to create an admin.
Data Validation: Usernames must be checked prior to creating new accounts to ensure they are not in use. Ensure to encode the username in the URL if it includes special characters or spaces.
Last updated