REST via Photon Server

Hello, mates!

I need some help with REST requests handling. Im trying to use AddRestRequestHandler to create some kind of health check controller, but getting "not found" when im sending request.

Should i use specific listener config or it's wrong path format or something else?

Here is my multiple handler registration attempts and current listener config


Best Answer

  • chvetsov
    chvetsov mod
    Answer ✓

    @Norfin yes, it might be that it does not work. A lot of changed since it was started.

    Because we did not test it quite long. and one think that was not implemented still, is that you are not able to send error back. only success.

    so, I would recommend to use OWIN or something like that.

    if you what our handlers working try next thing

    AddRestRequestHandler("healthcheck", ...);
    

    Listener config

    <HTTPListener
            Name="*:[PORT]::YourAppName"
            IPAddress="0.0.0.0"
            Port="80"
            DisableNagle="true"
            InactivityTimeout="35000"
          >
            <Routing>
              <Route Url="/api/*" PeerType="HTTP" Counters="true" OverrideApplication="YourAppName"/>
            </Routing>
          </HTTPListener>
    


    so, than it should work like http://address/api/healtcheck

    keep me updated about your results

    best,

    ilya

Answers

  • hi, @Norfin

    I would recommend for you to use Owin or something like that. Although this stuff is part of sdk it is kind of in intermediate state

    best,

    ilya

  • hi, Ilya

    does it mean AddRestRequestHandler is not working?

    thats sad if its true

    but how can i use middleware, if i can't get acces directly to requests due all proceesing is inside ApplicationBase

  • chvetsov
    chvetsov mod
    Answer ✓

    @Norfin yes, it might be that it does not work. A lot of changed since it was started.

    Because we did not test it quite long. and one think that was not implemented still, is that you are not able to send error back. only success.

    so, I would recommend to use OWIN or something like that.

    if you what our handlers working try next thing

    AddRestRequestHandler("healthcheck", ...);
    

    Listener config

    <HTTPListener
            Name="*:[PORT]::YourAppName"
            IPAddress="0.0.0.0"
            Port="80"
            DisableNagle="true"
            InactivityTimeout="35000"
          >
            <Routing>
              <Route Url="/api/*" PeerType="HTTP" Counters="true" OverrideApplication="YourAppName"/>
            </Routing>
          </HTTPListener>
    


    so, than it should work like http://address/api/healtcheck

    keep me updated about your results

    best,

    ilya

  • But im still interested in using OWIN or some other middleware, but still dont understand how, if all requests are processing by ApplicationBase

  • @Norfin

    if you are OWIN ApplicationBase is not involved


    best,

    ilya