help json request not work.

Post your questions about SoftEther VPN software here. Please answer questions if you can afford.
Post Reply
gorsing
Posts: 1
Joined: Wed Oct 16, 2019 9:47 am

help json request not work.

Post by gorsing » Wed Oct 16, 2019 10:54 am

help figure out why the json request doesn’t work. Or give an example of a work request

https://5.*.70.*:5555/api/{"jsonrpc": "2.0","id": "rpc_call_id","method": "Test","params": {"IntValue_u32": 0}}


{
"error": {
"code": 33,
"message": "Error code 33: Unsupported."
},
"jsonrpc": "2.0",
"id": "2019-10-16 10:23:24.403"
}

vpngemensch
Posts: 1
Joined: Mon Mar 06, 2023 7:11 pm

Re: help json request not work.

Post by vpngemensch » Mon Mar 06, 2023 7:13 pm

I got exactly the same problem... i want to make a call directly via url.. for /api/serverinfo it works.. for things that need input it does not work :(

shakibamoshiri
Posts: 285
Joined: Wed Dec 28, 2022 9:10 pm

Re: help json request not work.

Post by shakibamoshiri » Mon Mar 06, 2023 9:29 pm

vpngemensch wrote:
Mon Mar 06, 2023 7:13 pm
I got exactly the same problem... i want to make a call directly via url.. for /api/serverinfo it works.. for things that need input it does not work :(
check the source code
https://github.com/shakibamoshiri/secli

solo
Posts: 1228
Joined: Sun Feb 14, 2021 10:31 am

Re: help json request not work.

Post by solo » Tue Mar 07, 2023 3:14 am

This one-liner works for me...

Code: Select all

Linux
-----
curl -i -k -H "X-VPNADMIN-PASSWORD: ***" --json '{ "jsonrpc": "2.0", "id": "rpc_call_id", "method": "Test", "params": { "IntValue_u32": 0 } }' https://localhost:5555/api/

Windows
-------
curl -i -k -H "X-VPNADMIN-PASSWORD: ***" --json "{ \"jsonrpc\": \"2.0\", \"id\": \"rpc_call_id\", \"method\": \"Test\", \"params\": { \"IntValue_u32\": 0 } }" https://localhost:5555/api/

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: X-VPNADMIN-HUBNAME,X-VPNADMIN-PASSWORD
Access-Control-Allow-Methods: OPTIONS,GET,POST
Cache-Control: no-cache
Connection: Keep-Alive
Content-Length: 187
Content-Type: application/json
Date: Tue, 07 Mar 2023 03:02:40 GMT

{
    "result": {
        "Int64Value_u64": 0,
        "IntValue_u32": 0,
        "StrValue_str": "0",
        "UniStrValue_utf": ""
    },
    "jsonrpc": "2.0",
    "id": "rpc_call_id"
}

Post Reply