• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    API System giving 404 errors

    Scheduled Pinned Locked Moved Solved
    FOG Problems
    api custom script program 404
    4
    24
    6.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Tom ElliottT
      Tom Elliott @mwarner
      last edited by

      @mwarner A 403 means you’re missing the FOG-API-Token.

      401 (after getting fog-api-token set and sent) = you aren’t using a user token/basic auth to get information.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

      mwarnerM 1 Reply Last reply Reply Quote 0
      • mwarnerM
        mwarner @Tom Elliott
        last edited by

        @Tom-Elliott Right, but if I attach a proper endpoint (say /api/task/current) I get a 404. As far as I’m aware, /api by itself is useless and that seems to be the only endpoint sending a meaningful response (one that isn’t “not found”).

        1 Reply Last reply Reply Quote 0
        • Tom ElliottT
          Tom Elliott
          last edited by

          Can you post a copy of your current /etc/apache2/sites-enabled/001-fog.conf please?

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

          Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

          Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

          mwarnerM 1 Reply Last reply Reply Quote 0
          • mwarnerM
            mwarner @Tom Elliott
            last edited by

            @tom-elliott

            NameVirtualHost *:80
            <VirtualHost *:80>
                KeepAlive Off
                ServerName 10.1.10.254
                ServerAlias fog.emg-usa.com
                DocumentRoot /var/www/
                <Directory /var/www/fog/>
                    DirectoryIndex index.php index.html index.htm
                </Directory>
                RewriteEngine On
                RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
                RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
                # RewriteRule ^\/(.*)$ /fog/api/index.php [QSA,L]
            </VirtualHost>
            

            Just realized that I tried to comment out the RewriteRule in an attempt to get it working earlier. I just uncommented it and it works fine. So it definitely was the missing ServerAlias that was causing the issue.

            fog.emg-usa.com/fog/api/task/current
            

            and

            10.1.10.254/fog/api/task/current
            

            are both returning 403 errors now. I’ll add an API key in a moment to see if we can get some actual data back along with a 200 code!

            Tom ElliottT 1 Reply Last reply Reply Quote 0
            • Tom ElliottT
              Tom Elliott @mwarner
              last edited by

              @mwarner Loose the “api” portition of the call. ALl requests are happening via /fog/<item>/<item>

              /fog/api/<item> is invalid

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

              Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

              Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

              mwarnerM 1 Reply Last reply Reply Quote 0
              • mwarnerM
                mwarner @Tom Elliott
                last edited by

                @tom-elliott it still returns a 404 without /api in the URL

                mwarnerM 1 Reply Last reply Reply Quote 0
                • Tom ElliottT
                  Tom Elliott
                  last edited by

                  trying to hit you on chat.

                  Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                  Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                  Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                  1 Reply Last reply Reply Quote 0
                  • mwarnerM
                    mwarner @mwarner
                    last edited by

                    @Tom-Elliott I take that back, it returns a 403 in the browser but when I use CURL it returns 0 bytes of data unless I use /api in the URL

                    1 Reply Last reply Reply Quote 0
                    • Tom ElliottT
                      Tom Elliott
                      last edited by

                      Remoted with @mwarner and we were able to fix the problem.

                      They were accessing the api using :<url>/task/current when it should’ve been :<url>/fog/task/current.

                      The confusion came because they weren’t expecting to need the /fog portion as they allow the :<url> to go directly to the fog gui.

                      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                      1 Reply Last reply Reply Quote 2
                      • Tom ElliottT
                        Tom Elliott
                        last edited by

                        You think it’s safe to solve this now?

                        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                        1 Reply Last reply Reply Quote 0
                        • Wayne WorkmanW
                          Wayne Workman
                          last edited by

                          The examples I posted do have the /fog directory included in them.

                          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
                          Daily Clean Installation Results:
                          https://fogtesting.fogproject.us/
                          FOG Reporting:
                          https://fog-external-reporting-results.fogproject.us/

                          1 Reply Last reply Reply Quote 0
                          • mwarnerM
                            mwarner
                            last edited by

                            @Tom-Elliott Yes it is safe to solve now, sorry for the delay. Thanks again!

                            1 Reply Last reply Reply Quote 0
                            • 1
                            • 2
                            • 2 / 2
                            • First post
                              Last post

                            222

                            Online

                            12.0k

                            Users

                            17.3k

                            Topics

                            155.2k

                            Posts
                            Copyright © 2012-2024 FOG Project