This commit is contained in:
@@ -503,4 +503,61 @@ telnet 193.46.217.94 3128 # Проверка п
|
||||
private static final String SECRET_KEY = "YCPAPZ32XC-LWb8xE0b_xTcBD8NZUCHpSOfu8LUG";
|
||||
|
||||
Обновить сертики
|
||||
systemctl stop nginx && certbot renew && systemctl start nginx
|
||||
systemctl stop nginx && certbot renew && systemctl start nginx
|
||||
|
||||
|
||||
Создание API ключей для внешнего доступа
|
||||
|
||||
1.
|
||||
|
||||
POST /api/user/api-keys
|
||||
Authorization: Bearer {YOUR_JWT_TOKEN}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "My Integration Script"
|
||||
}
|
||||
|
||||
{
|
||||
"messageCode": "API_KEY_CREATED",
|
||||
"messageDesc": "Save this key. It will not be shown again.",
|
||||
"messageBody": {
|
||||
"apiKey": "ncp_dGhpcyBpc2EzcGFtcGxla2V5Zm9ydGVzdGluZw"
|
||||
}
|
||||
}
|
||||
|
||||
2. Использование API-ключа
|
||||
|
||||
GET /api/v1/files
|
||||
X-API-Key: ncp_dGhpcyBpc2EzcGFtcGxla2V5Zm9ydGVzdGluZw
|
||||
|
||||
curl -X GET \
|
||||
-H "X-API-Key: ncp_dGhpcyBpc2EzcGFtcGxla2V5Zm9ydGVzdGluZw" \
|
||||
https://api.nocopy.ru/api/v1/files
|
||||
|
||||
3.Просмотр списка ключей
|
||||
GET /api/user/api-keys
|
||||
Authorization: Bearer {YOUR_JWT_TOKEN}
|
||||
|
||||
{
|
||||
"messageCode": "OK",
|
||||
"messageBody": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "My Integration Script",
|
||||
"prefix": "dGhpcyBp",
|
||||
"isActive": true,
|
||||
"createdAt": "2024-01-15T10:30:00",
|
||||
"lastUsedAt": "2024-01-16T14:22:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
4. Отзыв API-ключа
|
||||
|
||||
DELETE /api/user/api-keys/{keyId}
|
||||
Authorization: Bearer {YOUR_JWT_TOKEN}
|
||||
|
||||
{
|
||||
"messageCode": "API_KEY_REVOKED"
|
||||
}
|
||||
Reference in New Issue
Block a user