Social Networks API
Endpoints for managing social networks in the system.
Get list of social networks
Get the complete list of social networks.
Request
GET /api/social-networks
Headers
Name | Type | Description |
---|---|---|
X-API-Key | string | Required. API key |
Query parameters
Name | Type | Description |
---|---|---|
page | integer | Optional. Page number (default: 1) |
per_page | integer | Optional. Number of records per page (default: 20) |
Response
{
"social_networks": [
{
"id": 1,
"key": "steam",
"cooldown_time": 3600,
"allow_to_register": true,
"icon": "<svg>...</svg>",
"enabled": true
},
{
"id": 2,
"key": "discord",
"cooldown_time": 7200,
"allow_to_register": true,
"icon": "<svg>...</svg>",
"enabled": true
}
]
}
Response fields
Field | Type | Description |
---|---|---|
social_networks | array | Array of social networks |
id | integer | Social network ID |
key | string | Social network key (identifier) |
cooldown_time | integer | Cooldown time between authorizations (in seconds) |
allow_to_register | boolean | Allow registration through this social network |
icon | string | Social network icon (SVG or image path) |
enabled | boolean | Activity status |
Response codes
Code | Description |
---|---|
200 | Successful request |
401 | Invalid or missing API key |
403 | Insufficient permissions for the request |
Get social network data
Get detailed information about a specific social network.
Request
GET /api/social-networks/{id}
Path parameters
Name | Type | Description |
---|---|---|
id | integer | Social network ID |
Headers
Name | Type | Description |
---|---|---|
X-API-Key | string | Required. API key |
Response
{
"social_network": {
"id": 1,
"key": "steam",
"cooldown_time": 3600,
"allow_to_register": true,
"icon": "<svg>...</svg>",
"enabled": true,
"settings": {
"client_id": "your-client-id",
"client_secret": "your-client-secret"
},
"users_count": 157
}
}
Response fields
Field | Type | Description |
---|---|---|
social_network | object | Social network object |
id | integer | Social network ID |
key | string | Social network key (identifier) |
cooldown_time | integer | Cooldown time between authorizations (in seconds) |
allow_to_register | boolean | Allow registration through this social network |
icon | string | Social network icon (SVG or image path) |
enabled | boolean | Activity status |
settings | object | Settings for connecting to social network API |
users_count | integer | Number of users using this social network |
Response codes
Code | Description |
---|---|
200 | Successful request |
401 | Invalid or missing API key |
403 | Insufficient permissions for the request |
404 | Social network not found |
Create social network
Create a new social network in the system.
Request
POST /api/social-networks
Headers
Name | Type | Description |
---|---|---|
X-API-Key | string | Required. API key |
Content-Type | string | Required. application/json |
Request body
{
"key": "vk",
"settings": "{\"keys\":{\"client_id\":\"your-client-id\",\"client_secret\":\"your-client-secret\"}}",
"cooldown_time": 3600,
"allow_to_register": true,
"icon": "<svg>...</svg>",
"enabled": false
}
Request body parameters
Name | Type | Description |
---|---|---|
key | string | Required. Social network key (identifier) |
settings | string | Required. JSON string with connection settings |
cooldown_time | integer | Optional. Cooldown time between authorizations (sec) |
allow_to_register | boolean | Optional. Allow registration through this social network |
icon | string | Required. Social network icon |
enabled | boolean | Optional. Activity status |
Response
{
"message": "Social network created successfully",
"social_network": {
"id": 3,
"key": "vk",
"cooldown_time": 3600,
"allow_to_register": true,
"icon": "<svg>...</svg>",
"enabled": false
}
}
Response codes
Code | Description |
---|---|
201 | Social network created successfully |
401 | Invalid or missing API key |
403 | Insufficient permissions for the request |
422 | Invalid request parameters |
Update social network
Update an existing social network.
Request
PUT /api/social-networks/{id}
Path parameters
Name | Type | Description |
---|---|---|
id | integer | Social network ID |
Headers
Name | Type | Description |
---|---|---|
X-API-Key | string | Required. API key |
Content-Type | string | Required. application/json |
Request body
{
"key": "vk",
"settings": "{\"keys\":{\"client_id\":\"updated-client-id\",\"client_secret\":\"updated-client-secret\"}}",
"cooldown_time": 1800,
"allow_to_register": true,
"icon": "<svg>...</svg>",
"enabled": true
}
Request body parameters
Name | Type | Description |
---|---|---|
key | string | Required. Social network key (identifier) |
settings | string | Required. JSON string with connection settings |
cooldown_time | integer | Optional. Cooldown time between authorizations (sec) |
allow_to_register | boolean | Optional. Allow registration through this social network |
icon | string | Required. Social network icon |
enabled | boolean | Optional. Activity status |
Response
{
"message": "Social network updated successfully",
"social_network": {
"id": 3,
"key": "vk",
"cooldown_time": 1800,
"allow_to_register": true,
"icon": "<svg>...</svg>",
"enabled": true
}
}
Response codes
Code | Description |
---|---|
200 | Social network updated successfully |
401 | Invalid or missing API key |
403 | Insufficient permissions for the request |
404 | Social network not found |
422 | Invalid request parameters |
Delete social network
Delete a social network from the system.
Request
DELETE /api/social-networks/{id}
Path parameters
Name | Type | Description |
---|---|---|
id | integer | Social network ID |
Headers
Name | Type | Description |
---|---|---|
X-API-Key | string | Required. API key |
Response
{
"message": "Social network deleted successfully"
}
Response codes
Code | Description |
---|---|
200 | Social network deleted successfully |
401 | Invalid or missing API key |
403 | Insufficient permissions for the request |
404 | Social network not found |
422 | Cannot delete, there are linked users |
Get social network users
Get a list of users using a specific social network.
Request
GET /api/social-networks/{id}/users
Path parameters
Name | Type | Description |
---|---|---|
id | integer | Social network ID |
Headers
Name | Type | Description |
---|---|---|
X-API-Key | string | Required. API key |
Query parameters
Name | Type | Description |
---|---|---|
page | integer | Optional. Page number (default: 1) |
per_page | integer | Optional. Number of records per page (default: 20) |
Response
{
"users": [
{
"id": 1,
"name": "John Doe",
"login": "john123",
"value": "12345678",
"url": "https://example.com/profile/12345678",
"linked_at": "2023-01-01T10:30:00Z"
},
{
"id": 2,
"name": "Jane Smith",
"login": "jane456",
"value": "87654321",
"url": "https://example.com/profile/87654321",
"linked_at": "2023-02-15T14:20:00Z"
}
],
"total": 157,
"page": 1,
"per_page": 20
}
Response fields
Field | Type | Description |
---|---|---|
users | array | Array of users |
id | integer | User ID |
name | string | User name |
login | string | User login |
value | string | User identifier in the social network |
url | string | Profile URL in the social network |
linked_at | string | Account linking date |
total | integer | Total number of users |
page | integer | Current page |
per_page | integer | Number of records per page |
Response codes
Code | Description |
---|---|
200 | Successful request |
401 | Invalid or missing API key |
403 | Insufficient permissions for the request |
404 | Social network not found |
Toggle social network status
Enable or disable a social network.
Request
PATCH /api/social-networks/{id}/toggle
Path parameters
Name | Type | Description |
---|---|---|
id | integer | Social network ID |
Headers
Name | Type | Description |
---|---|---|
X-API-Key | string | Required. API key |
Response
{
"message": "Social network status updated successfully",
"social_network": {
"id": 1,
"key": "steam",
"cooldown_time": 3600,
"allow_to_register": true,
"icon": "<svg>...</svg>",
"enabled": false
}
}
Response codes
Code | Description |
---|---|
200 | Social network status updated successfully |
401 | Invalid or missing API key |
403 | Insufficient permissions for the request |
404 | Social network not found |
Get social network statistics
Get statistics for a specific social network.
Request
GET /api/social-networks/{id}/stats
Path parameters
Name | Type | Description |
---|---|---|
id | integer | Social network ID |
Headers
Name | Type | Description |
---|---|---|
X-API-Key | string | Required. API key |
Response
{
"stats": {
"total_users": 157,
"active_users": 142,
"registrations_this_month": 23,
"last_authorization": "2024-01-15T10:30:00Z"
}
}
Response fields
Field | Type | Description |
---|---|---|
stats | object | Statistics object |
total_users | integer | Total number of users using this social network |
active_users | integer | Number of active users |
registrations_this_month | integer | Number of registrations this month |
last_authorization | string | Date and time of last authorization (ISO 8601) |
Response codes
Code | Description |
---|---|
200 | Successful request |
401 | Invalid or missing API key |
403 | Insufficient permissions for the request |
404 | Social network not found |