Integrations
info
- We're assuming your API key is set in the environment variable
$KEY
Creating integration
- cURL
- Python
curl -i -H "x-api-key: ${KEY}" -X POST -H "Content-Type: application/json" \
https://admin.api.crowdsec.net/v1/integrations \
-d '{ "name": "test_integration_1", "description": "my test integration", "entity_type": "firewall_integration", "output_format": "plain_text" }'
import os
KEY = os.getenv('KEY')
from crowdsec_service_api import (
Integrations,
Server,
ApiKeyAuth,
)
from crowdsec_service_api.models import IntegrationCreateRequest
auth = ApiKeyAuth(api_key=KEY)
client = Integrations(base_url=Server.production_server.value, auth=auth)
request = IntegrationCreateRequest(
name='test_integration_1',
description='my test integration',
entity_type='firewall_integration',
output_format='plain_text',
)
response = client.create_integration(
request=request,
)
print(response)
warning
The username
and password
will only be displayed at creation time, be sure to write them down. If you lose them, you can always regenerate them with the update
method.
answer on success
{
"id": "INTEGRATIONID12345",
"name": "test_integration_1",
"organization_id": "MY-ORG-ID-abcdef1234",
"description": "my test integration",
"created_at": "2024-06-07T14:00:31.645929Z",
"updated_at": "2024-06-07T14:00:31.645943Z",
"entity_type": "firewall_integration",
"output_format": "plain_text",
"last_pull": null,
"blocklists": [],
"endpoint": "https://admin.api.crowdsec.net/v1/integrations/INTEGRATIONID12345/content",
"stats": {
"count": 0
},
"credentials": {
"username": "<login>",
"password": "<password>"
}
}
View integration content
View integration content allows you to preview the list of IPs that are returned to your firewall (or whatever is going to consume the integration).
curl -i -u '<login>:<password>' https://admin.api.crowdsec.net/v1/integrations/INTEGRATIONID12345/content