GET /v1/topics/{id}
from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import (
AuthProvider,
OpenMetadataConnection,
)
from metadata.generated.schema.security.client.openMetadataJWTClientConfig import (
OpenMetadataJWTClientConfig,
)
from metadata.ingestion.ometa.ometa_api import OpenMetadata
from metadata.generated.schema.entity.data.topic import Topic
metadata = OpenMetadata(
OpenMetadataConnection(
hostPort="https://your-company.open-metadata.org/api",
authProvider=AuthProvider.openmetadata,
securityConfig=OpenMetadataJWTClientConfig(jwtToken="your-jwt-token"),
)
)
# Get by ID
topic = metadata.get_by_id(entity=Topic, entity_id="0a021819-982e-4ee4-a5a2-4af30eaa3016")
print(f"{topic.fullyQualifiedName.root}: {topic.description.root}")
# Get by ID with fields
topic = metadata.get_by_id(
entity=Topic,
entity_id="0a021819-982e-4ee4-a5a2-4af30eaa3016",
fields=["owners", "tags", "messageSchema"]
)
# Get by fully qualified name
topic = metadata.get_by_name(entity=Topic, fqn="sample_kafka.address_book")
# Get by name with fields
topic = metadata.get_by_name(
entity=Topic,
fqn="sample_kafka.address_book",
fields=["owners", "tags", "domains"]
)
import org.openmetadata.schema.entity.data.Topic;
// client is an initialized OpenMetadataClient.
// Get by ID
Topic topic = client.topics().get("0a021819-982e-4ee4-a5a2-4af30eaa3016");
// Get by ID with fields
Topic topicWithFields = client.topics().get(
"0a021819-982e-4ee4-a5a2-4af30eaa3016",
"owners,tags,messageSchema"
);
// Get by fully qualified name
Topic topicByName = client.topics().getByName("sample_kafka.address_book");
// Get by name with fields
Topic topicByNameWithFields = client.topics().getByName(
"sample_kafka.address_book",
"owners,tags,domains"
);
# Get by ID
curl "{base_url}/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016" \
-H "Authorization: Bearer {access_token}"
# Get by ID with fields
curl "{base_url}/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016?fields=owners,tags,domains" \
-H "Authorization: Bearer {access_token}"
# Get by fully qualified name
curl "{base_url}/api/v1/topics/name/sample_kafka.address_book" \
-H "Authorization: Bearer {access_token}"
# Get by name with fields
curl "{base_url}/api/v1/topics/name/sample_kafka.address_book?fields=owners,tags,domains" \
-H "Authorization: Bearer {access_token}"
{
"id": "0a021819-982e-4ee4-a5a2-4af30eaa3016",
"name": "address_book",
"fullyQualifiedName": "sample_kafka.address_book",
"description": "All Protobuf record related events gets captured in this topic",
"version": 0.1,
"updatedAt": 1769982663546,
"updatedBy": "admin",
"service": {
"id": "469ef25e-9bdf-4d5f-8553-eb0ce8581f30",
"type": "messagingService",
"name": "sample_kafka",
"fullyQualifiedName": "sample_kafka",
"displayName": "sample_kafka",
"deleted": false
},
"serviceType": "Kafka",
"messageSchema": {
"schemaText": "syntax = \"proto2\";\npackage tutorial;\nmessage Person { ... }",
"schemaType": "Protobuf",
"schemaFields": [
{
"name": "AddressBook",
"dataType": "RECORD",
"fullyQualifiedName": "sample_kafka.address_book.AddressBook",
"children": []
}
]
},
"partitions": 1,
"cleanupPolicies": ["delete"],
"replicationFactor": 1,
"maximumMessageSize": 1,
"retentionSize": -1,
"href": "http://localhost:8585/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016",
"deleted": false,
"owners": [],
"tags": [],
"followers": [],
"votes": {
"upVotes": 0,
"downVotes": 0,
"upVoters": [],
"downVoters": []
},
"domains": []
}
Retrieve a Topic
Get a topic by ID or fully qualified name
GET
/
v1
/
topics
/
{id}
GET /v1/topics/{id}
from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import (
AuthProvider,
OpenMetadataConnection,
)
from metadata.generated.schema.security.client.openMetadataJWTClientConfig import (
OpenMetadataJWTClientConfig,
)
from metadata.ingestion.ometa.ometa_api import OpenMetadata
from metadata.generated.schema.entity.data.topic import Topic
metadata = OpenMetadata(
OpenMetadataConnection(
hostPort="https://your-company.open-metadata.org/api",
authProvider=AuthProvider.openmetadata,
securityConfig=OpenMetadataJWTClientConfig(jwtToken="your-jwt-token"),
)
)
# Get by ID
topic = metadata.get_by_id(entity=Topic, entity_id="0a021819-982e-4ee4-a5a2-4af30eaa3016")
print(f"{topic.fullyQualifiedName.root}: {topic.description.root}")
# Get by ID with fields
topic = metadata.get_by_id(
entity=Topic,
entity_id="0a021819-982e-4ee4-a5a2-4af30eaa3016",
fields=["owners", "tags", "messageSchema"]
)
# Get by fully qualified name
topic = metadata.get_by_name(entity=Topic, fqn="sample_kafka.address_book")
# Get by name with fields
topic = metadata.get_by_name(
entity=Topic,
fqn="sample_kafka.address_book",
fields=["owners", "tags", "domains"]
)
import org.openmetadata.schema.entity.data.Topic;
// client is an initialized OpenMetadataClient.
// Get by ID
Topic topic = client.topics().get("0a021819-982e-4ee4-a5a2-4af30eaa3016");
// Get by ID with fields
Topic topicWithFields = client.topics().get(
"0a021819-982e-4ee4-a5a2-4af30eaa3016",
"owners,tags,messageSchema"
);
// Get by fully qualified name
Topic topicByName = client.topics().getByName("sample_kafka.address_book");
// Get by name with fields
Topic topicByNameWithFields = client.topics().getByName(
"sample_kafka.address_book",
"owners,tags,domains"
);
# Get by ID
curl "{base_url}/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016" \
-H "Authorization: Bearer {access_token}"
# Get by ID with fields
curl "{base_url}/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016?fields=owners,tags,domains" \
-H "Authorization: Bearer {access_token}"
# Get by fully qualified name
curl "{base_url}/api/v1/topics/name/sample_kafka.address_book" \
-H "Authorization: Bearer {access_token}"
# Get by name with fields
curl "{base_url}/api/v1/topics/name/sample_kafka.address_book?fields=owners,tags,domains" \
-H "Authorization: Bearer {access_token}"
{
"id": "0a021819-982e-4ee4-a5a2-4af30eaa3016",
"name": "address_book",
"fullyQualifiedName": "sample_kafka.address_book",
"description": "All Protobuf record related events gets captured in this topic",
"version": 0.1,
"updatedAt": 1769982663546,
"updatedBy": "admin",
"service": {
"id": "469ef25e-9bdf-4d5f-8553-eb0ce8581f30",
"type": "messagingService",
"name": "sample_kafka",
"fullyQualifiedName": "sample_kafka",
"displayName": "sample_kafka",
"deleted": false
},
"serviceType": "Kafka",
"messageSchema": {
"schemaText": "syntax = \"proto2\";\npackage tutorial;\nmessage Person { ... }",
"schemaType": "Protobuf",
"schemaFields": [
{
"name": "AddressBook",
"dataType": "RECORD",
"fullyQualifiedName": "sample_kafka.address_book.AddressBook",
"children": []
}
]
},
"partitions": 1,
"cleanupPolicies": ["delete"],
"replicationFactor": 1,
"maximumMessageSize": 1,
"retentionSize": -1,
"href": "http://localhost:8585/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016",
"deleted": false,
"owners": [],
"tags": [],
"followers": [],
"votes": {
"upVotes": 0,
"downVotes": 0,
"upVoters": [],
"downVoters": []
},
"domains": []
}
Retrieve a Topic
Get a single topic by its unique ID or fully qualified name.Get by ID
Comma-separated list of fields to include, for example
owners,tags,followers,votes,extension,domains,sourceHash.Get by Fully Qualified Name
UseGET /v1/topics/name/{fqn} to retrieve by fully qualified name.
Comma-separated list of fields to include:
owners, tags, followers, votes, extension, domains, sourceHash.GET /v1/topics/{id}
from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import (
AuthProvider,
OpenMetadataConnection,
)
from metadata.generated.schema.security.client.openMetadataJWTClientConfig import (
OpenMetadataJWTClientConfig,
)
from metadata.ingestion.ometa.ometa_api import OpenMetadata
from metadata.generated.schema.entity.data.topic import Topic
metadata = OpenMetadata(
OpenMetadataConnection(
hostPort="https://your-company.open-metadata.org/api",
authProvider=AuthProvider.openmetadata,
securityConfig=OpenMetadataJWTClientConfig(jwtToken="your-jwt-token"),
)
)
# Get by ID
topic = metadata.get_by_id(entity=Topic, entity_id="0a021819-982e-4ee4-a5a2-4af30eaa3016")
print(f"{topic.fullyQualifiedName.root}: {topic.description.root}")
# Get by ID with fields
topic = metadata.get_by_id(
entity=Topic,
entity_id="0a021819-982e-4ee4-a5a2-4af30eaa3016",
fields=["owners", "tags", "messageSchema"]
)
# Get by fully qualified name
topic = metadata.get_by_name(entity=Topic, fqn="sample_kafka.address_book")
# Get by name with fields
topic = metadata.get_by_name(
entity=Topic,
fqn="sample_kafka.address_book",
fields=["owners", "tags", "domains"]
)
import org.openmetadata.schema.entity.data.Topic;
// client is an initialized OpenMetadataClient.
// Get by ID
Topic topic = client.topics().get("0a021819-982e-4ee4-a5a2-4af30eaa3016");
// Get by ID with fields
Topic topicWithFields = client.topics().get(
"0a021819-982e-4ee4-a5a2-4af30eaa3016",
"owners,tags,messageSchema"
);
// Get by fully qualified name
Topic topicByName = client.topics().getByName("sample_kafka.address_book");
// Get by name with fields
Topic topicByNameWithFields = client.topics().getByName(
"sample_kafka.address_book",
"owners,tags,domains"
);
# Get by ID
curl "{base_url}/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016" \
-H "Authorization: Bearer {access_token}"
# Get by ID with fields
curl "{base_url}/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016?fields=owners,tags,domains" \
-H "Authorization: Bearer {access_token}"
# Get by fully qualified name
curl "{base_url}/api/v1/topics/name/sample_kafka.address_book" \
-H "Authorization: Bearer {access_token}"
# Get by name with fields
curl "{base_url}/api/v1/topics/name/sample_kafka.address_book?fields=owners,tags,domains" \
-H "Authorization: Bearer {access_token}"
{
"id": "0a021819-982e-4ee4-a5a2-4af30eaa3016",
"name": "address_book",
"fullyQualifiedName": "sample_kafka.address_book",
"description": "All Protobuf record related events gets captured in this topic",
"version": 0.1,
"updatedAt": 1769982663546,
"updatedBy": "admin",
"service": {
"id": "469ef25e-9bdf-4d5f-8553-eb0ce8581f30",
"type": "messagingService",
"name": "sample_kafka",
"fullyQualifiedName": "sample_kafka",
"displayName": "sample_kafka",
"deleted": false
},
"serviceType": "Kafka",
"messageSchema": {
"schemaText": "syntax = \"proto2\";\npackage tutorial;\nmessage Person { ... }",
"schemaType": "Protobuf",
"schemaFields": [
{
"name": "AddressBook",
"dataType": "RECORD",
"fullyQualifiedName": "sample_kafka.address_book.AddressBook",
"children": []
}
]
},
"partitions": 1,
"cleanupPolicies": ["delete"],
"replicationFactor": 1,
"maximumMessageSize": 1,
"retentionSize": -1,
"href": "http://localhost:8585/api/v1/topics/0a021819-982e-4ee4-a5a2-4af30eaa3016",
"deleted": false,
"owners": [],
"tags": [],
"followers": [],
"votes": {
"upVotes": 0,
"downVotes": 0,
"upVoters": [],
"downVoters": []
},
"domains": []
}
Returns
Returns a topic object with all requested fields populated.Response
Error Handling
| Code | Error Type | Description |
|---|---|---|
401 | UNAUTHORIZED | Invalid or missing authentication token |
403 | FORBIDDEN | User lacks permission to view this topic |
404 | NOT_FOUND | Topic with given ID or FQN does not exist |
Was this page helpful?