Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endpoint ' {variable]' not recognized #87

Open
iMelsom opened this issue Mar 30, 2020 · 5 comments
Open

Endpoint ' {variable]' not recognized #87

iMelsom opened this issue Mar 30, 2020 · 5 comments
Assignees
Labels
Bug FixedInNextBeta Hang tight: we think this is now resolved in a forthcoming update... R5 Issue relating to Snarl R5.x

Comments

@iMelsom
Copy link

iMelsom commented Mar 30, 2020

Hi
When trying to use WebSNP / Oxide WebSNP v1 responds correctly, but v2 stubbornly refuse to work.
Sending the test message http://{ip-address}/v1 gives the expected reply
Sending the test message http://{ip-address}/v2 gives an empty reply
I have tried both the LAN Ipaddress (192.168.2.10) and "localhost" for {ip-address}
For port number I have tried 8080. 8084, and 23053
(I know 23053 is the GNTP port, but since I am scripting to replace a PHP-GNTP script that din't survive upgrade to PHP7.4, the easiest route is to reuse allready open firewall rules)

I get the following errors in reply when I add /apps or /registrations:

C:\Snarl 5.1>curl -H "Content-Type: application/json" "http://localhost:8080/v2/registrations" -d "{ \"app-id\": \"foo.bar\", \"title\": \"Foo.Bar\" }"
{
  "Content": null,
  "Succeeded": false,
  "StatusCode": 215,
  "StatusText": "NotFound",
  "Message": "Endpoint 'registrations' not recognised"
}
C:\Snarl 5.1>curl -H "Content-Type: application/json" "http://localhost:8080/v2/registrations" -d "{ \"app-id\": \"foo.bar\", \"title\": \"Foo.Bar\" }"
{
  "Content": null,
  "Succeeded": false,
  "StatusCode": 215,
  "StatusText": "NotFound",
  "Message": "Endpoint 'registrations' not recognised"
}

snarl --log shows this:


[2020-03-30 11:32:00.252] AsyncTcpServer.acceptCallback(): new connection from 127.0.0.1:52655
[2020-03-30 11:32:00.262] HTTPRequest.HTTPRequest(): requestLine="POST /v2/apps HTTP/1.1"
[2020-03-30 11:32:00.262] [snphttp] server_OnRequestReceived(): uri="/v2/apps"
[2020-03-30 11:32:00.262] [snphttp] server_OnRequestReceived(): body="{ "app-id": "foo.bar", "title": "Foo.Bar" }"
[2020-03-30 11:32:00.262] [snphttp] V2 request!
[2020-03-30 11:32:00.262] * method: "POST"
[2020-03-30 11:32:00.262] * uri: "/v2/apps"
[2020-03-30 11:32:00.262] * body: "{ "app-id": "foo.bar", "title": "Foo.Bar" }"
[2020-03-30 11:32:00.262] + apps
[2020-03-30 11:32:00.262] count:1

[2020-03-30 11:32:16.089] AsyncTcpServer.acceptCallback(): new connection from 127.0.0.1:52657
[2020-03-30 11:32:16.099] HTTPRequest.HTTPRequest(): requestLine="POST /v2/registrations HTTP/1.1"
[2020-03-30 11:32:16.099] [snphttp] server_OnRequestReceived(): uri="/v2/registrations"
[2020-03-30 11:32:16.099] [snphttp] server_OnRequestReceived(): body="{ "app-id": "foo.bar", "title": "Foo.Bar" }"
[2020-03-30 11:32:16.099] [snphttp] V2 request!
[2020-03-30 11:32:16.099] * method: "POST"
[2020-03-30 11:32:16.099] * uri: "/v2/registrations"
[2020-03-30 11:32:16.099] * body: "{ "app-id": "foo.bar", "title": "Foo.Bar" }"
[2020-03-30 11:32:16.099] + registrations
[2020-03-30 11:32:16.099] count:1
@iMelsom
Copy link
Author

iMelsom commented Mar 30, 2020

Logfile attached

snarl-5-1.debug.log

@fullphat
Copy link
Owner

WebSNP V2 doesn't work properly in Beta 4. Apologies - I ripped a lot of the transports right back to basics as it was all getting a bit messy. I think the win32ipc transport supports everything now, right back to really old versions of the Snarl API.

As for WebSNP, I think Beta 4 has V0 and V1 complete and working, but V2 isn't there.

As a test, GET /v2/infoshould work, but very little else will right now.

@iMelsom
Copy link
Author

iMelsom commented Mar 30, 2020

Ah. I see. That explains my problems :D

Thank you for the update! :)

@fullphat fullphat self-assigned this Mar 30, 2020
@fullphat fullphat added Bug FixedInNextBeta Hang tight: we think this is now resolved in a forthcoming update... R5 Issue relating to Snarl R5.x labels Mar 30, 2020
@fullphat
Copy link
Owner

fullphat commented Mar 31, 2020

Quick update. I've re-implemented /v2/registrations so, in the next beta, the following will work:

curl -H "Content-Type: application/json" "http://localhost:8080/v2/registrations" -d "{ \"appid\": \"foo.bar\", \"name\": \"Foo.Bar\" }

Note the parameter name changes for app-id (appid) and title (name) however.

@fullphat
Copy link
Owner

This is possible too 😁

curl -H "Content-Type: application/json" "http://localhost:8084/v2/registrations" -d "{ \"appid\": \"foo.bar\", \"name\": \"Foo.Bar\", \"version\": \"23\", \"icons\": { \"stock\": \"misc-hotdog\" }, \"events\": [ { \"id\": \"1\", \"name\": \"one\" }, { \"id\": \"2\", \"name\": \"two\", \"enabled\": false } ] }"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug FixedInNextBeta Hang tight: we think this is now resolved in a forthcoming update... R5 Issue relating to Snarl R5.x
Projects
None yet
Development

No branches or pull requests

2 participants