Navigation

    Home
    All Categories
    • KEEN Trail Camera
    • Top #ReolinkCaptures Awards
    • Announcements and News
    • Wishlist
    • #ReolinkTrial
    • Discussion About Products
    • Reolink Captures
    • Reolink Client & APP
    #ReolinkTrial
    Reolink Captures
    Log in to post
    Guest
    • Guest
    • Register
    • Login

    Learn More

    Reolink updates Learn More

    Meet Reolink at IFA 2024! Learn More

    Reolink Q&A Learn More

    Cannot use CGI/API

    Discussion About Products
    curl cgi
    2
    11
    1405
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • micciche.matteo
      micciche.matteo last edited by

      Hey there,

      I own a RLC-520A. I'm testing these CGI commands: https://support.reolink.com/hc/en-us/article_attachments/15340090739353/Command.pdf
      Anyway, I'm stuck at the login. I can't even get the token for a long session connection. I also tested the short session.

      Here's an example:

      When I run every command (from Windows), for example a very basic one like GetTime

      curl -L -k -H 'Content-Type:application/json' -X POST -d '[{"cmd":"GetTime","action":"1"}]' "http://ip_address/api.cgi?cmd=GetTime&user=user&password=password"


      I get this error:

      <html>
      <head><title>405 Not Allowed</title></head>
      <body bgcolor="white">
      <center><h1>405 Not Allowed</h1></center>
      <hr><center>nginx</center>
      </body>
      </html>

      Please also note that I need to add the -L parameter. Otherwise, I get:

      <html>
      <head><title>302 Found</title></head>
      <body bgcolor="white">
      <center><h1>302 Found</h1></center>
      <hr><center>nginx</center>
      </body>
      </html>

      I searched everywhere online and I can't figure it out what the issue here. Any help?

      Reply Quote
      Share
      • Share this Post
      • Facebook
      • Twitter
      • copy the link
        Copied!
      0
        • joseph_1979
          Joseph Global Moderator @micciche.matteo last edited by

          @micciche-matteo_650487669628980 Fairly easy. Use the following curl command. Replace #IP#, #username# and #password# respectively.

          curl -s -k -X POST -H "Content-Type : application/json" -d "[{\"cmd\":\"GetTime\",\"action\":1}]" "https://#IP#/cgi-bin/api.cgi?user=#username#&password=#password#"

          Reply Quote
          Share
          • Share this Post
          • Facebook
          • Twitter
          • copy the link
            Copied!
          0
          • micciche.matteo
            micciche.matteo @Joseph last edited by

            @joseph-chircop_497308027822318 Yeah, of course. I used those not to paste here my private information

            Reply Quote
            Share
            • Share this Post
            • Facebook
            • Twitter
            • copy the link
              Copied!
            0
            • micciche.matteo
              micciche.matteo @Joseph last edited by

              @joseph-chircop_497308027822318

              Still this output tho:
              <html>
              <head><title>405 Not Allowed</title></head>
              <body bgcolor="white">
              <center><h1>405 Not Allowed</h1></center>
              <hr><center>nginx</center>
              </body>
              </html>

              Reply Quote
              Share
              • Share this Post
              • Facebook
              • Twitter
              • copy the link
                Copied!
              0
              • joseph_1979
                Joseph Global Moderator @micciche.matteo last edited by

                @micciche-matteo_650487669628980 Ensure HTTPS is enabled on the camera. I used it without any issue on a number of cameras.

                Reply Quote
                Share
                • Share this Post
                • Facebook
                • Twitter
                • copy the link
                  Copied!
                0
                • micciche.matteo
                  micciche.matteo @Joseph last edited by

                  @joseph-chircop_497308027822318 Yeah cool! HTTP (not HTTPS) was disabled.

                  Anyway, now when I run the command I get:

                  [
                    {
                     "cmd" : "GetTime",
                     "code" : 1,
                     "error" : {
                       "detail" : "please login first",
                       "rspCode" : -6
                     }
                    }
                  ]

                  Anyway, don't worry, I should be able to find out why. You already made my day today, thanks!

                  Reply Quote
                  Share
                  • Share this Post
                  • Facebook
                  • Twitter
                  • copy the link
                    Copied!
                  0
                  • joseph_1979
                    Joseph Global Moderator @micciche.matteo last edited by

                    @micciche-matteo_650487669628980 eh...you didn't enter my command which was based on https. In your curl L parameter requests Auth. Never use http unless you are on a secured internal network. Anyone with a wireshark can see your credentials as these are sent in plain text.

                    Reply Quote
                    Share
                    • Share this Post
                    • Facebook
                    • Twitter
                    • copy the link
                      Copied!
                    0
                    • micciche.matteo
                      micciche.matteo @Joseph last edited by

                      @joseph-chircop_497308027822318 Thank you. Sorry I didn't mention that this was a preliminary test to run this command on a Mikrotik Router (RouterOS scripting). All good, leaving the command here if it can help someone:

                      Enable or disable Push (that was my goal, change "enable" to 0 or 1), if a specified IP address (my phone) is pinged or not. In this way I have an automatic system that enables push notification when I leave home and switch them off when I come back:

                      :local url "https://192.168.xx.xx/api.cgi?cmd=SetPushV20&user=user&password=password"
                      
                      
                      /tool fetch url=$url mode=https http-method=post http-data="[{\"cmd\":\"SetPushV20\",\"param\":{\"Push\":{\"enable\":0,\"schedule\":{\"channel\":0,\"table\":{\"MD\":\"111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\"}}}}}]"


                      Reply Quote
                      Share
                      • Share this Post
                      • Facebook
                      • Twitter
                      • copy the link
                        Copied!
                      0
                      • joseph_1979
                        Joseph Global Moderator @micciche.matteo last edited by joseph_1979

                        @micciche-matteo_650487669628980 So you implemented Geofencing before Reolink :). Have been asking for it for quite some time and didn't hear anything. First try to interrogate and then set if unset. Using Mikrotik .... hmmm... Had some issues (MTU) with customers who had VOIP. Note that the ISP changes the IP of your router unless you subscribe for a fixed IP.


                        Reply Quote
                        Share
                        • Share this Post
                        • Facebook
                        • Twitter
                        • copy the link
                          Copied!
                        0
                        • micciche.matteo
                          micciche.matteo @Joseph last edited by

                          Actually, the ISP is not even involved because the command is sent directly from the router on the internal network, nothing travels over the public IP. As soon as my phone connects to the home network, the router sends the command to the IP room on the same network. Personally, I love MikroTik and RouterOS, you can really do a lot with it. For example, I can even send myself a notification via pushover telling me if the Reolink push is active or not.

                          Reply Quote
                          Share
                          • Share this Post
                          • Facebook
                          • Twitter
                          • copy the link
                            Copied!
                          1
                          • joseph_1979
                            Joseph Global Moderator @micciche.matteo last edited by

                            @micciche-matteo_650487669628980 Being internal than it's fine. Yep the scripting is powerful.

                            Reply Quote
                            Share
                            • Share this Post
                            • Facebook
                            • Twitter
                            • copy the link
                              Copied!
                            0
                            View 8 replies
                          • First post
                            Last post
                          All Categories
                          Announcements and News Reolink Client & APP Discussion About Products #ReolinkTrial Reolink Captures Wishlist KEEN Trail Camera
                          Never miss Reolink hot deals, news, and updates tailored for you.

                          Thanks for your subscription!

                          Please enter a valid email address.

                          Oops… Something went wrong. Please try again later.

                          You are already subscribed to this email list. :)

                          Submission failed. Please try again later.

                          Reolink Store|Support|About Us|Privacy Policy|Terms and Conditions

                          Copyright 2025 © Reolink All Rights Reserved.

                          Welcome Back!

                          Hi there! Join the Commnunity to get all the latest news, tips and more!

                          Join Now