Example showing how to login and execute a command that requires authentication using curl:
curl
$ curl -i --header 'Referer: http://localhost:8080' --data 'username=admin&password=adminadmin' http://localhost:8080/api/v2/auth/loginHTTP/1.1 200 OKContent-Encoding:Content-Length: 3Content-Type: text/plain; charset=UTF-8Set-Cookie: SID=hBc7TxF76ERhvIw0jQQ4LZ7Z1jQUV0tQ; path=/$ curl http://localhost:8080/api/v2/torrents/info --cookie "SID=hBc7TxF76ERhvIw0jQQ4LZ7Z1jQUV0tQ" Copy
$ curl -i --header 'Referer: http://localhost:8080' --data 'username=admin&password=adminadmin' http://localhost:8080/api/v2/auth/loginHTTP/1.1 200 OKContent-Encoding:Content-Length: 3Content-Type: text/plain; charset=UTF-8Set-Cookie: SID=hBc7TxF76ERhvIw0jQQ4LZ7Z1jQUV0tQ; path=/$ curl http://localhost:8080/api/v2/torrents/info --cookie "SID=hBc7TxF76ERhvIw0jQQ4LZ7Z1jQUV0tQ"
Note: Set Referer or Origin header to the exact same domain and port as used in the HTTP query Host header.
Referer
Origin
Host
Optional
Example showing how to login and execute a command that requires authentication using
curl:Note: Set
RefererorOriginheader to the exact same domain and port as used in the HTTP queryHostheader.