POST /api/v1/team-members/invites/{inviteCode}
The endpoint accepts a team member invite via an HTTP POST request to https://api.locate2u.com/api/v1/team-members/invites/{inviteCode}, invite code is sent in the path.
Input parameter:
inviteCode
inviteCode required string in the path of the request. This invite code can be sent by Locate2u user from the app portal to invite members to their team.
Sample code
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// Replace "your_invite_code" with the actual invite code
string inviteCode = "your_invite_code";
string apiUrl = $"https://api.locate2u.com/api/v1/team-members/invites/{inviteCode}";
// Replace "your_access_token" with your actual access token if needed
string accessToken = "your_access_token";
// Create an instance of HttpClient
using (var httpClient = new HttpClient())
{
// Add authorization header if needed
if (!string.IsNullOrEmpty(accessToken))
{
httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
}
// Define the request content (if needed)
// For example, you can pass JSON data in the request body
// string jsonContent = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
// Create the HTTP request
var httpRequest = new HttpRequestMessage(HttpMethod.Post, apiUrl);
// Add content to the request if needed
// httpRequest.Content = new StringContent(jsonContent, System.Text.Encoding.UTF8, "application/json");
// Send the request and get the response
var response = await httpClient.SendAsync(httpRequest);
// Check if the request was successful
if (response.IsSuccessStatusCode)
{
// Read the response content
string responseContent = await response.Content.ReadAsStringAsync();
Console.WriteLine("Request successful. Response:");
Console.WriteLine(responseContent);
}
else
{
// If request was not successful, print the status code
Console.WriteLine($"Request failed with status code {response.StatusCode}");
}
}
}
}
import okhttp3.*;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
// Replace "your_invite_code" with the actual invite code
String inviteCode = "your_invite_code";
String apiUrl = "https://api.locate2u.com/api/v1/team-members/invites/" + inviteCode;
// Replace "your_access_token" with your actual access token if needed
String accessToken = "your_access_token";
// Create OkHttpClient instance
OkHttpClient client = new OkHttpClient();
// Build request
Request.Builder requestBuilder = new Request.Builder()
.url(apiUrl)
.post(RequestBody.create(MediaType.parse("application/json"), ""));
// Add authorization header if needed
if (!accessToken.isEmpty()) {
requestBuilder.addHeader("Authorization", "Bearer " + accessToken);
}
// Execute request
client.newCall(requestBuilder.build()).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
e.printStackTrace();
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if (response.isSuccessful()) {
String responseBody = response.body().string();
System.out.println("Request successful. Response:");
System.out.println(responseBody);
} else {
System.out.println("Request failed with status code: " + response.code());
}
response.close();
}
});
}
}
const http = require('http');
// Replace "your_invite_code" with the actual invite code
const inviteCode = "your_invite_code";
const apiUrl = `https://api.locate2u.com/api/v1/team-members/invites/${inviteCode}`;
// Replace "your_access_token" with your actual access token if needed
const accessToken = "your_access_token";
// Define request options
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
// Add authorization header if needed
'Authorization': `Bearer ${accessToken}`
}
};
// Make POST request
const req = http.request(apiUrl, options, (res) => {
let data = '';
// A chunk of data has been received.
res.on('data', (chunk) => {
data += chunk;
});
// The whole response has been received.
res.on('end', () => {
console.log('Request successful. Response:');
console.log(data);
});
});
// Handle error
req.on('error', (error) => {
console.error('Request failed:', error);
});
// End the request
req.end();
import requests
# Replace "your_invite_code" with the actual invite code
invite_code = "your_invite_code"
api_url = f"https://api.locate2u.com/api/v1/team-members/invites/{invite_code}"
# Replace "your_access_token" with your actual access token if needed
access_token = "your_access_token"
# Define headers
headers = {}
# Add authorization header if needed
if access_token:
headers["Authorization"] = f"Bearer {access_token}"
# Make POST request
response = requests.post(api_url, headers=headers)
# Check if request was successful
if response.status_code == 200:
print("Request successful. Response:")
print(response.text)
else:
print(f"Request failed with status code {response.status_code}")
Response
CodeDescription
200 Success
401 Unauthorized
403 Forbidden