$ curl -X POST https://cloud.logintc.com/api/domains/9120580e94f134cb7c9f27cd1e43dbc82980e152/sessions \
-d '{"user" : {"id" : "8c184f495a5b7b6e9ed732f2ce3c67e310806f38"}, "attributes" : [{"key" : "IP Address", "value" : "10.0.10.142"}, {"key" : "username", "value" : "root"}]}' \
-H 'Authorization: LoginTC key="YOUR_API_KEY"'
{
"id" : "fcbdc4c271c889825d8338d2d8f10b6e5e95c171",
"state" : "pending"
}
<?php
// Get the library from github.com/logintc/logintc-php
require_once('logintc-php/LoginTC.php');
// Your API Key from cloud.logintc.com/panel/settings
$api_key = 'YOUR_API_KEY';
$logintc = new LoginTC($api_key);
// Domain id
$domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152';
// User id
$user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38';
// Domain attributes
$attribute1 = new DomainAttribute('IP Address', '10.0.10.142');
$attribute2 = new DomainAttribute('username', 'root');
$attributes = array($attribute1, $attribute2);
// Helper function to create session with attributes
$session = $logintc->createSession($domain_id, $user_id, $attributes);
echo $session->getState();
# Get the library from github.com/logintc/logintc-python
import logintc
# Your API Key from cloud.logintc.com/panel/settings
api_key = 'YOUR_API_KEY'
client = logintc.LoginTC(api_key)
# Domain id
domain_id = '9120580e94f134cb7c9f27cd1e43dbc82980e152'
# User id
user_id = '8c184f495a5b7b6e9ed732f2ce3c67e310806f38'
# Domain attributes
attributes = [{'key' : 'IP Address',
'value' : '10.0.10.142'},
{'key' : 'username',
'value' : 'root'}]
# Helper function to create session with attributes
session = client.create_session(domain_id, user_id, attributes)
print session['state']
// Get the library from github.com/logintc/logintc-java
import com.cyphercor.logintc.LoginTC;
import com.cyphercor.logintc.LoginTC.LoginTCException;
import com.cyphercor.logintc.resource.Session;
import java.util.HashMap;
import java.util.Map;
public class Example {
// Your API Key from cloud.logintc.com/panel/settings
public static final String API_KEY = "YOUR_API_KEY";
public static void main(String[] args) throws LoginTCException {
LoginTC logintc = new LoginTC(API_KEY);
// Domain id
String domainId = "9120580e94f134cb7c9f27cd1e43dbc82980e152";
// User id
String userId = "8c184f495a5b7b6e9ed732f2ce3c67e310806f38";
// Domain attributes
Map<String, String> attributes = new HashMap<String, String>();
attributes.put("IP Address", "10.0.10.142");
attributes.put("username", "root");
// Helper function to create session with attributes
Session session = logintc.createSession(domainId, userId, attributes);
System.out.println(session.getState());
}
}