Create New Connection
Step 2 of the API flow. Establish a new connection to the ART platform using your JWT token and receive a connection ID for subsequent operations.
Endpoint: POST /v1/connect/new-connection
Headers:
Content-Type: application/jsonX-Org- Your organization identifierEnvironment- Your environment nameProjectKey- Your project keyAuthorization: Bearer {token}- Your JWT token
Request Body:
{
"username": "your_username",
"first_name": "first_name",
"last_name": "last_name"
}
Response:
{
"status": 200,
"data": {
"connection_id": "unique_connection_identifier"
},
"message": "Connection ID generated successfully"
}
Code Examples
- JavaScript
- cURL
// Using fetch API
const createConnection = async (token) => {
const response = await fetch('https://dev.arealtimetech.com/ws/v1/connect/new-connection', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Org': 'your_organization',
'Environment': 'your_environment',
'ProjectKey': 'your_project_key',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
username: "your_username",
first_name: "first_name",
last_name: "last_name"
})
});
const data = await response.json();
console.log('Connection ID:', data.data.connection_id);
console.log('Status:', data.status);
return data.data.connection_id;
};
// Call the function with your JWT token
const connectionId = await createConnection('your_jwt_token');
curl -X POST "https://dev.arealtimetech.com/ws/v1/connect/new-connection" \
-H "Content-Type: application/json" \
-H "X-Org: your_organization" \
-H "Environment: your_environment" \
-H "ProjectKey: your_project_key" \
-H "Authorization: Bearer your_jwt_token" \
-d '{
"username": "your_username",
"first_name": "first_name",
"last_name": "last_name"
}'