Results 1 to 7 of 7
  1. #1
    Untangle Ninja
    WebFooL's Avatar
    Join Date
    Jan 2009
    Location
    Sweden (Eskilstuna)
    Posts
    5,257

    Default Getting "method not found (session may have timed out)"

    Trying to collect wireguard-vpn ID form the /admin/JSON-RPC endpoint but it gives me:

    Code:
      "id": 297,  "error": {
        "msg": "method not found (session may have timed out)",
        "code": 591
      }
    As an response.


    Both the Login and getting the nonce works but trying to get the ID for Wireguard-VPN by asking for id 297 just will not work.

    Code:
            $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
            $headers.Add("Content-Type", "application/json")
            $body = "{`n    `"id`":297,`n    `"nonce`":$nonce,`n    `"method`":`".obj#9283067.app`",`n    `"params`":[`n        `"wireguard-vpn`"`n    ]`n}"
            $response = Invoke-RestMethod "https://$UntangleURL/admin/JSON-RPC" -Method 'POST' -Headers $headers -Body $body -WebSession $cookie -SkipCertificateCheck
            $response | ConvertTo-Json
    $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"$headers.Add("Content-Type", "application/json")$body = "{`n    `"id`":297,`n    `"nonce`":ec61pq84h9ov52ev9nurmldr95,`n    `"method`":`".obj#9283067.app`",`n    `"params`":[`n        `"web-filter`"`n    ]`n}"$response = Invoke-RestMethod 'https://10.11.12.223/admin/JSON-RPC' -Method 'POST' -Headers $headers -Body $body
    $response | ConvertTo-Json
    Sample form https://apidocs.untangle.com/#413895...2-5e83fa9677bf

    Is the documentation wrong or am reading it wrong?

  2. #2
    Untangle Ninja
    WebFooL's Avatar
    Join Date
    Jan 2009
    Location
    Sweden (Eskilstuna)
    Posts
    5,257

    Default

    Looks like method ".obj#1528481557.app" works.
    Is there a way to get what method one should use?

    This script will be touching a few boxes :-)

  3. #3
    Untangle Ninja
    WebFooL's Avatar
    Join Date
    Jan 2009
    Location
    Sweden (Eskilstuna)
    Posts
    5,257

    Default

    yes.. the ".obj#1528481557.app" method did not work on the next box.
    is there away to know/ask for what method to use?

  4. #4
    Newbie
    Join Date
    Jul 2017
    Posts
    6

    Default

    Hi WebFooL,

    The "id" value in the request body isn't really pertinent, it's used on the frontend mostly. You can omit it if you'd like. The ID you'll need is the appManager which can be obtained by using the 'Get appManager ID' request. Find it here. The Object ID returned is what you want. From there, use the appManager ID like so:
    Code:
    {
    	"nonce":{{nonce_token}},
    	"method":".obj#{{appManagerID}}.app",
    	"params":[
    		"wireguard-vpn"
    	]
    }
    That will return the app-specific ID for wireguard. You can replace 'wireguard-vpn' above to any app. The appManager ID is specific to the box. Also, I did notice the documentation had 'web-filter' in place of 'wireguard-vpn' in the example request so that may have caused some confusion. I fixed that. Let me know if that answers your question.

  5. #5
    Newbie
    Join Date
    Jul 2017
    Posts
    6

    Default

    In other words, to get down to manipulating 'wireguard-vpn', you'll need to authenticate, then get the nonce-token, then get the appManager ID, then you can get the Wireguard app ID.

  6. #6
    Untangle Ninja
    WebFooL's Avatar
    Join Date
    Jan 2009
    Location
    Sweden (Eskilstuna)
    Posts
    5,257

    Default

    Login = OK
    Nonce = OK
    appManagerID = NoGO at the moment.


    After this if i find it My script works. (Creating tunnel/Downloading Config/ etc etc)

    So where in the docs dose it give an example on how to get the appManagerID?
    I am using
    $body = "{`n `"id`":297,`n `"nonce`":$nonce,`n `"method`":`".obj#1528481557.app`",`n `"params`":[`n `"wireguard-vpn`"`n ]`n}"
    As body and then I get the response needed but the method app i use here seams to just be working on one box.
    Is that the appManagerID?

  7. #7
    Untangle Ninja
    WebFooL's Avatar
    Join Date
    Jan 2009
    Location
    Sweden (Eskilstuna)
    Posts
    5,257

    Default

    Found the sample..
    "appManagerID" != "appManager ID" :-)


    And now the script works as I want..
    Thanks...

    Of and deploying a few hundreds Wireguard clients....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

SEO by vBSEO 3.6.0 PL2