General API guide
Overview
The General API Guide provides a set of API endpoints to perform various actions related to the Analytics Connector service. These endpoints allow you to manage connectors, retrieve information about available topics, check connector statuses, and more. This section provides step-by-step instructions on using each API endpoint effectively.
Prerequisites
- Access to the AGS Admin Portal.
Get a list of topics or analytics data
Retrieve a list of all available namespaces and topics via the API endpoint [GET] /analytics-connector/v1/admin/tools/kafka/topics/{eventType}
. Replace {eventType}
with the appropriate event type. The API will return a response containing namespaces and their associated topics:
{
"namespace1" : [
"topic-analytics-event-1",
"topic-analytics-event-2"
]
}
Get Connector status
Check the status of a specific connector using the API endpoint [GET] /analytics-connector/v1/admin/connectors/{id}/status
. Replace {id}
with the connector's ID obtained from the API response after successful creation. The API will return the connector's status and related information:
{
"time": "2023-06-08T10:22:01Z",
"connector": "<connector-name>",
"status": "ACTIVE",
"error": null
}
Get Connector list
Retrieve a list of all connector configurations via the API endpoint [GET] /analytics-connector/v1/admin/connectors
. The API will return a list of connector configurations.
Pause S3 Connector
Pause a specific connector using the API endpoint [PUT] /analytics-connector/v1/admin/connectors/{id}/deactivate
. Replace {id}
with the connector's ID. The API will return a response confirming the pause.
{
"id": 1,
"active": false
}
Resume Connector
Resume or reactivate a specific connector using the API endpoint [PUT] /analytics-connector/v1/admin/connectors/{id}/activate
. Replace {id} with the connector's ID. The API will return a response confirming the reactivation.
{
"id": 1,
"active": true
}
Edit Connector
Edit the configuration of a specific connector using the API endpoint [PUT] /analytics-connector/v1/admin/connectors{id}
. Replace {id}
with the connector's ID. Modify the connector's configuration in the provided JSON structure.
Example S3 connector:
{
"storageType": "KAFKA_S3",
"config": {
"bucketName": "<s3-bucket-name>",
"region": "<s3-bucket-region>",
"customPath": "<s3-path>",
"customPartitionDuration": "<s3-partition-duration>",
"partSize": "5242880",
"flushInterval": "<flush-sending-interval>",
"eventType": "<event-type>",
"flushSize": "<flush-size>"
},
"filter": {
"<namespace>": [
"<topic>"
]
}
}
The event type, storage type, and connector name cannot be changed.
Delete Connector
Delete a specific connector using the API endpoint [DELETE] /analytics-connector/v1/admin/connectors/{id}
. Replace {id} with the connector's ID. The API will return a response confirming the deletion.
{
"deleted": true,
"id": 1
}
Get the Access Token Using IAM Client ID and Client Secret
- Go to Admin Portal and sign in
- Authorizations Menu > IAM Clients
- Create New
- Pick Confidential on Client Type
- Generate secret, save id and secret to be used later
- Fill in the Client Name e.g. analytics-connector
- Redirect URl can be filled with http://127.0.0.1
- Click Create button
- In the newly IAM Clients created, Go to the tab Permissions
- Click Add button
- Add permission resource
- ADMIN:ROLE with Action Read
- ADMIN:NAMESPACE:*:CLIENT with Action Read
- ADMIN:ANALYTICS:CONNECTOR with Action Create, Read, Update, Delete
- Go to IAM apidocs
- Authorize > Basic Authorization
- Fill in the IAM Client Id in the username
- Fill in the Client's secret in the password, then click Authorize in the Basic Authorization section
- Go to this endpoint /iam/v3/oauth/token
- Select the client_credentials as the grant_type
- Click Execute button
- Copy the access_token and paste it into the Connector API Authorization HTTP Bearer section