When authorization is enabled, all API handlers require an Authorization header containing a valid token.
In case of an error, the service returns an appropriate HTTP status code and a response similar to the following:
{
"statusMessage": "error reason here"
}name must be unique.
curl http://127.0.0.1:8080/api/category/listResponse
{
"categories": [
{
"id": 1,
"name": "fun"
},
{
"id": 2,
"name": "work"
}
]
}curl -X POST http://127.0.0.1:8080/api/category/filter -H "Content-Type: application/json" -d '{"name": "or"}'Response
{
"categories": [
{
"id": 2,
"name": "work"
},
{
"id": 3,
"name": "new category name"
}
]
}curl http://127.0.0.1:8080/api/category/list/1Response
{
"id": 1,
"name": "fun"
}name must not be empty.
curl -X POST http://127.0.0.1:8080/api/category/list -H "Content-Type: application/json" -d '{"name": "category name"}'Response
{
"id": 1,
"name": "category name"
}name must not be empty.
curl -X PUT http://127.0.0.1:8080/api/category/list/1 -H "Content-Type: application/json" -d '{"name": "new category name"}'Response
{
"id": 1,
"name": "new category name"
}curl -X DELETE http://127.0.0.1:8080/api/category/list/1Response: HTTP 200 with empty body
type must be one of
- DIRECT
- PROXY
- SOCKS
- SOCKS4
- SOCKS5
- HTTP
- HTTPS
address must not be empty except for type == DIRECT
curl http://127.0.0.1:8080/api/proxy/listResponse
{
"proxies": [
{
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:8080",
"description": "local proxy"
},
{
"id": 2,
"type": "SOCKS",
"address": "10.10.0.10:8080",
"description": "dante"
}
]
}curl -X POST http://127.0.0.1:8080/api/proxy/filter -H "Content-Type: application/json" -d '{"type": "HTT", "address": "127"}'Response
{
"proxies": [
{
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:8080",
"description": "local proxy"
}
]
}curl http://127.0.0.1:8080/api/proxy/list/1Response
{
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:8080",
"description": "local proxy"
}If type != DIRECT address must not be empty.
If type == DIRECT address must be empty.
curl -X POST http://127.0.0.1:8080/api/proxy/list -H "Content-Type: application/json" -d '{"type": "HTTP", "address": "127.0.0.1:1080", "description": "Proxy description"}'Response
{
"id": 3,
"type": "HTTP",
"address": "127.0.0.1:1080",
"description": "Proxy description"
}If type != DIRECT provided or existing address must not be empty.
If any of type, address or description fields are not provided in request, corresponding values remain unchanged.
curl -X PUT http://127.0.0.1:8080/api/proxy/list/1 -H "Content-Type: application/json" -d '{"type": "HTTP", "address": "127.0.0.1:80", "description": "updated description"}'Response
{
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:80",
"description": "updated description"
}curl -X DELETE http://127.0.0.1:8080/api/proxy/list/1Response: HTTP 200 with empty body
type must be one of
- host_domain_only
- host_domain_subdomain
- host_subdomain_only
- url_shexp_match
- url_regexp_match
expression must not be empty.
- type = "host_domain_only"
Host equals to provided domain.
- type = "host_domain_subdomain"
Host equals to provided domain or is subdomain of provided domain.
- type = "host_subdomain_only"
Host is subdomain of provided domain.
- type = "url_shexp_match"
- type = "url_regexp_match"
curl http://127.0.0.1:8080/api/condition/listResponse
{
"conditions": [
{
"id": 1,
"type": "host_domain_subdomain",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
},
{
"id": 2,
"type": "host_domain_only",
"expression": "memes.com",
"category": {
"id": 1,
"name": "fun"
}
},
{
"id": 3,
"type": "host_subdomain_only",
"expression": "noexample.com",
"category": {
"id": 2,
"name": "work"
}
}
]
}curl http://127.0.0.1:8080/api/condition/1Response
{
"id": 1,
"type": "host_domain_subdomain",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
}curl -X POST http://127.0.0.1:8080/api/condition/list -H "Content-Type: application/json" -d '{"type": "host_domain_only", "expression": "example.com", "categoryId": 1}'Response
{
"id": 4,
"type": "host_domain_only",
"expression": "example.com",
"category": {
"id": 1,
"name": "fun"
}
}If any of type, expression or categoryId fields are not provided in request, corresponding values remain unchanged.
curl -X PUT http://127.0.0.1:8080/api/condition/list/1 -H "Content-Type: application/json" -d '{"type": "host_domain_subdomain", "expression": "example.com", "categoryId": 1}'Response
{
"id": 1,
"type": "host_domain_subdomain",
"expression": "example.com",
"category": {
"id": 1,
"name": "fun"
}
}curl -X DELETE http://127.0.0.1:8080/api/condition/list/1Response: HTTP 200 with empty body
curl http://127.0.0.1:8080/api/proxyrule/listResponse
{
"proxyRules": [
{
"id": 1,
"proxy": {
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:80",
"description": "updated description"
},
"enabled": true,
"name": "proxy group 1",
"conditions": [
{
"id": 1,
"type": "host_domain_subdomain",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
}
]
}
]
}curl http://127.0.0.1:8080/api/proxyrule/list/1Response
{
"id": 1,
"proxy": {
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:80",
"description": "updated description"
},
"enabled": true,
"name": "proxy group 1",
"conditions": [
{
"id": 1,
"type": "host_domain_subdomain",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
}
]
}curl -X POST http://127.0.0.1:8080/api/proxyrule/list -H "Content-Type: application/json" -d '{"proxyId": 1, "enabled": true, "name": "proxy group 1", "conditionIds": [1,2]}'Response
{
"id": 4,
"proxy": {
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:80",
"description": "updated description"
},
"enabled": true,
"name": "proxy group 1",
"conditions": [
{
"id": 1,
"type": "host_domain_subdomain",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
},
{
"id": 2,
"type": "host_domain_only",
"expression": "example.com",
"category": {
"id": 1,
"name": "fun"
}
}
]
}If any of proxyId, enabled, name or conditionIds fields are not provided in request, corresponding values remain unchanged.
curl -X PUT http://127.0.0.1:8080/api/proxyrule/list/1 -H "Content-Type: application/json" -d '{"proxyId": 1, "enabled": true, "name": "proxy group updated", "conditionIds": [2]}'Response
{
"id": 1,
"proxy": {
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:80",
"description": "updated description"
},
"enabled": true,
"name": "proxy group updated",
"conditions": [
{
"id": 2,
"type": "host_domain_only",
"expression": "example.com",
"category": {
"id": 1,
"name": "fun"
}
}
]
}curl -X DELETE http://127.0.0.1:8080/api/proxyrule/list/1Response: HTTP 200 with empty body
curl http://127.0.0.1:8080/api/proxyrule/list/1/conditionsResponse
{
"conditions": [
{
"id": 1,
"type": "host_domain_subdomain",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
},
{
"id": 2,
"type": "host_domain_only",
"expression": "example.com",
"category": {
"id": 1,
"name": "fun"
}
}
]
}curl -X POST http://127.0.0.1:8080/api/proxyrule/list/1/conditions/3Returns updated conditions for proxy rules object.
{
"conditions": [
{
"id": 1,
"type": "host_domain_subdomain",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
},
{
"id": 2,
"type": "host_domain_only",
"expression": "example.com",
"category": {
"id": 1,
"name": "fun"
}
},
{
"id": 3,
"type": "host_domain_only",
"expression": "noexample.com",
"category": {
"id": 2,
"name": "work"
}
}
]
}curl -X DELETE http://127.0.0.1:8080/api/proxyrule/list/1/conditions/3Response: HTTP 200 with empty body
curl http://127.0.0.1:8080/api/pac/listResponse
{
"pacs": [
{
"id": 1,
"name": "pac 1",
"description": "some PAC",
"serve": true,
"servePath": "pac1.pac",
"saveToFS": false,
"saveToFSPath": "pac1.pac",
"fallbackProxy": {
"id": 4,
"type": "DIRECT",
"address": "",
"description": "no proxy"
}
}
]
}curl http://127.0.0.1:8080/api/pac/list/1Response
{
"id": 1,
"name": "pac 1",
"description": "some PAC",
"proxyRules": [
{
"proxyRule": {
"id": 1,
"proxy": {
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:8080",
"description": "local proxy"
},
"enabled": true,
"name": "some proxy group",
"conditions": [
{
"id": 1,
"type": "host_domain_only",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
},
{
"id": 2,
"type": "host_domain_subdomain",
"expression": "memes.com",
"category": {
"id": 1,
"name": "fun"
}
}
]
},
"priority": 1
}
],
"serve": true,
"servePath": "pac1.pac",
"saveToFS": false,
"saveToFSPath": "pac1.pac",
"fallbackProxy": {
"id": 4,
"type": "DIRECT",
"address": "",
"description": "no proxy"
}
}curl -X POST http://127.0.0.1:8080/api/pac/list -H "Content-Type: application/json" -d '{"name": "pac 2", "description": "PAC for something else", "proxyRules": [{"proxyRuleId": 1, "priority":1}], "fallbackProxyId": 3, "serve": true, "servePath": "pac2.pac", "saveToFS": true, "saveToFSPath": "pac2.pac"}'Response
{
"id": 2,
"name": "pac 2",
"description": "PAC for something else",
"proxyRules": [
{
"proxyRule": {
"id": 1,
"proxy": {
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:8080",
"description": "local proxy"
},
"enabled": true,
"name": "some proxy group",
"conditions": [
{
"id": 1,
"type": "host_domain_only",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
},
{
"id": 2,
"type": "host_domain_subdomain",
"expression": "memes.com",
"category": {
"id": 1,
"name": "fun"
}
}
]
},
"priority": 1
}
],
"serve": true,
"servePath": "pac2.pac",
"saveToFS": true,
"saveToFSPath": "pac2.pac",
"fallbackProxy": {
"id": 3,
"type": "PROXY",
"address": "127.0.0.1:1080",
"description": "Proxy description"
}
}curl -X PUT http://127.0.0.1:8080/api/pac/list/2 -H "Content-Type: application/json" -d '{"name": "pac 2 updated", "description": "PAC for something else updated", "proxyRules": [{"proxyRuleId": 2, "priority":1}], "fallbackProxyId": 2, "serve": false, "servePath": "pac2updated.pac", "saveToFS": false, "saveToFSPath": "pac2updated.pac"}'Response
{
"id": 2,
"name": "pac 2 updated",
"description": "PAC for something else updated",
"proxyRules": [
{
"proxyRule": {
"id": 2,
"proxy": {
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:8080",
"description": "local proxy"
},
"enabled": true,
"name": "proxy group 1",
"conditions": [
{
"id": 1,
"type": "host_domain_only",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
},
{
"id": 3,
"type": "host_subdomain_only",
"expression": "ya.ru",
"category": {
"id": 2,
"name": "work"
}
}
]
},
"priority": 1
}
],
"serve": false,
"servePath": "pac2updated.pac",
"saveToFS": false,
"saveToFSPath": "pac2updated.pac",
"fallbackProxy": {
"id": 2,
"type": "SOCKS",
"address": "10.10.0.10:8080",
"description": "dante"
}
}curl -X DELETE http://127.0.0.1:8080/api/pac/list/2Response: HTTP 200 with empty body
curl http://127.0.0.1:8080/api/pac/list/1/proxyrulesResponse
{
"proxyRules": [
{
"proxyRule": {
"id": 1,
"proxy": {
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:8080",
"description": "local proxy"
},
"enabled": true,
"name": "some proxy group",
"conditions": [
{
"id": 1,
"type": "host_domain_only",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
},
{
"id": 2,
"type": "host_domain_subdomain",
"expression": "memes.com",
"category": {
"id": 1,
"name": "fun"
}
}
]
},
"priority": 1
}
]
}curl -X POST http://127.0.0.1:8080/api/pac/list/1/proxyrules/2?priority=2Returns updated proxy rules for PAC object.
{
"proxyRules": [
{
"proxyRule": {
"id": 1,
"proxy": {
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:8080",
"description": "local proxy"
},
"enabled": true,
"name": "some proxy group",
"conditions": [
{
"id": 1,
"type": "host_domain_only",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
},
{
"id": 2,
"type": "host_domain_subdomain",
"expression": "memes.com",
"category": {
"id": 1,
"name": "fun"
}
}
]
},
"priority": 1
},
{
"proxyRule": {
"id": 2,
"proxy": {
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:8080",
"description": "local proxy"
},
"enabled": true,
"name": "proxy group 1",
"conditions": [
{
"id": 1,
"type": "host_domain_only",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
},
{
"id": 3,
"type": "host_subdomain_only",
"expression": "ya.ru",
"category": {
"id": 2,
"name": "work"
}
}
]
},
"priority": 2
}
]
}curl -X PATCH http://127.0.0.1:8080/api/pac/list/1/proxyrules/2?priority=10Returns updated proxy rules for PAC object.
{
"proxyRules": [
{
"proxyRule": {
"id": 1,
"proxy": {
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:8080",
"description": "local proxy"
},
"enabled": true,
"name": "some proxy group",
"conditions": [
{
"id": 1,
"type": "host_domain_only",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
},
{
"id": 2,
"type": "host_domain_subdomain",
"expression": "memes.com",
"category": {
"id": 1,
"name": "fun"
}
}
]
},
"priority": 1
},
{
"proxyRule": {
"id": 2,
"proxy": {
"id": 1,
"type": "HTTP",
"address": "127.0.0.1:8080",
"description": "local proxy"
},
"enabled": true,
"name": "proxy group 1",
"conditions": [
{
"id": 1,
"type": "host_domain_only",
"expression": "google.com",
"category": {
"id": 2,
"name": "work"
}
},
{
"id": 3,
"type": "host_subdomain_only",
"expression": "ya.ru",
"category": {
"id": 2,
"name": "work"
}
}
]
},
"priority": 10
}
]
}curl -X DELETE http://127.0.0.1:8080/api/pac/list/1/proxyrules/2Response: HTTP 200 with empty body
Password is SHA256 of password string.
Here 8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918 = SHA256("admin").
curl -X POST http://127.0.0.1:8080/api/user/login?user=admin\&password=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918Response
{
"token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiY3JlYXRlZEF0IjoxNzY1MjIzODgzfQ.chtn-6SX3Q_tj2NbmGLkEwJB6NUcXDRms5q59QEn-Yx0L7yoQUzynHpOhCD8t2BU6V0xpkI-3Sp_IKYpj44rLA"
}curl -X POST http://127.0.0.1:8080/api/user/logout -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiY3JlYXRlZEF0IjoxNzY1MjIzNjU2fQ.3z8VeN0FerbZT4w8U8aCjkK7O9NouKMFScEwXly22FxIbTkkpADS-1yWZmTivIgqxA_G5ffH4-L8A2n-275ELg'Response: HTTP 200 with empty body
curl http://127.0.0.1:8080/api/user/profile -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiY3JlYXRlZEF0IjoxNzY1MjIzNjU2fQ.3z8VeN0FerbZT4w8U8aCjkK7O9NouKMFScEwXly22FxIbTkkpADS-1yWZmTivIgqxA_G5ffH4-L8A2n-275ELg'Response
{
"userName": "admin"
}