Overview
Generates ConnID (Connector Identity) Groovy code from attributes for the specified object class. ConnID code defines how the connector identifies and references objects in the target system.
Path Parameters
The unique identifier of the session
The name of the object class (e.g., “account”, “user”, “group”)
Query Parameters
Whether to use previous session data for generation. Set to false to force regeneration from scratch.
Request
No request body is required. The endpoint automatically loads attributes from the session data.
Response
The unique identifier for the created code generation job
Example Response
{
"jobId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
}
Prerequisites
Before calling this endpoint, you must:
- Create a session using
POST /api/v1/session
- Generate attributes for the object class using
POST /api/v1/session/{session_id}/classes/{object_class}/attributes
If attributes are not found in the session, the endpoint returns a 404 error.
Status Codes
Session not found or attributes not available for the object class
Example Request
curl -X POST "https://api.example.com/api/v1/session/123e4567-e89b-12d3-a456-426614174000/classes/account/connid?usePreviousSessionData=true" \
-H "Content-Type: application/json"
Checking Job Status
After creating the job, use the GET endpoint to check the generation status:
curl "https://api.example.com/api/v1/session/123e4567-e89b-12d3-a456-426614174000/classes/account/connid?jobId=b2c3d4e5-f6a7-8901-bcde-f12345678901"
Status Response
{
"jobId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"status": "finished",
"createdAt": "2026-03-10T12:01:00Z",
"startedAt": "2026-03-10T12:01:01Z",
"updatedAt": "2026-03-10T12:01:30Z",
"progress": {
"stage": "finished",
"message": "ConnID code generated successfully"
},
"result": {
"code": "// Generated ConnID Groovy code\n..."
}
}
Manually Override ConnID
You can manually override the generated ConnID code using the PUT endpoint:
curl -X PUT "https://api.example.com/api/v1/session/123e4567-e89b-12d3-a456-426614174000/classes/account/connid" \
-H "Content-Type: application/json" \
-d '{
"code": "// Custom ConnID Groovy code\n..."
}'
Override Response
{
"message": "ConnID for account overridden successfully",
"sessionId": "123e4567-e89b-12d3-a456-426614174000",
"objectClass": "account"
}
Generated Code Structure
The generated ConnID code typically includes:
- Unique identifier field selection
- Name attribute mapping
- UID generation logic
- Primary key handling
Example generated ConnID code:
// Define how to build ConnId
uid {
if (obj.id) {
return new Uid(obj.id as String)
}
throw new IllegalStateException("Cannot create UID: 'id' field is missing")
}
// Define the naming attribute
name {
if (obj.username) {
return new Name(obj.username as String)
}
return uid()
}
Understanding ConnID
ConnID (Connector Identity) defines:
- UID: The unique identifier used to reference objects in the target system
- Name: The human-readable name attribute (often username, email, or display name)
- Identity resolution: How to map between midPoint and target system identities
The generated code ensures proper identity handling throughout the connector lifecycle.
Error Responses
404 Not Found - Session Not Found
{
"detail": "Session with ID 123e4567-e89b-12d3-a456-426614174000 not found"
}
404 Not Found - Attributes Not Available
{
"detail": "No attributes found for account in session 123e4567-e89b-12d3-a456-426614174000. Please run /classes/account/attributes endpoint first."
}