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

    FOG API

    Scheduled Pinned Locked Moved
    General
    5
    19
    4.4k
    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.
    • M
      maikBat
      last edited by

      Thank so much for the fast respond. I will check it.

      george1421G 1 Reply Last reply Reply Quote 0
      • george1421G
        george1421 Moderator @maikBat
        last edited by

        @maikbat Here is another thread: https://forums.fogproject.org/topic/10036/api That official document is hidden really well from me.

        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!

        george1421G 1 Reply Last reply Reply Quote 0
        • george1421G
          george1421 Moderator @george1421
          last edited by

          @george1421 Ah hidden under news (??) https://news.fogproject.org/simplified-api-documentation/

          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!

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

            @Tom-Elliott could you post a copy of your Insomnia environment export for the FOG API? If you don’t have it anymore I can create one - but was just asking since it’s only like 15 seconds to export and post here. I’m sure others here would like to have it besides me.

            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
            • M
              maikBat @george1421
              last edited by

              @george1421 I checked the API info, Is amazing to know that this is available. Now I have a couple questions:

              Where I can find the task IDs? Will be great to have the “Task IDs” and other options related with them.

              In summary, this is what I want to try to do:

              • Register a host (name:MAC, MAC:MAC, ImageID:ImageIDNumber)
              • Deploy Image on host
              • Unregister Host

              I pretend do all this using php and json

              Thanks

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

                @maikbat this will probably get you going :

                https://forums.fogproject.org/topic/11059/clearing-specific-kinds-of-task-types-using-sql

                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/

                M 1 Reply Last reply Reply Quote 0
                • M
                  maikBat @Wayne Workman
                  last edited by

                  @wayne-workman I got everything setup in my server but when I try to send a post i’m receiving this:

                  <!DOCTYPE HTML PUBLIC “-//IETF//DTD HTML 2.0//EN”>
                  <html><head>
                  <title>404 Not Found</title>
                  </head><body>
                  <h1>Not Found</h1>
                  <p>The requested URL /fog/host/AABBCC/task was not found on this server.</p>
                  <hr>
                  <address>Apache/2.4.29 (Ubuntu) Server at 192.168.70.3 Port 9000</address>
                  </body></html>

                  I’m using port 9000 because I have other service running on 80. I need to run fog and my app in the same server.
                  The Fog management, PXE and image clone services are working properly and the API is enabled.

                  Fog running Version: 1.4.4

                  Thanks

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

                    @maikbat Read through this entire thread: https://forums.fogproject.org/topic/9779/can-i-use-some-kind-of-script-to-create-image-and-ghost-my-lab-machines/12?page=2

                    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/

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      maikBat @Wayne Workman
                      last edited by

                      @wayne-workman Just let you know that everything is working now. The problem was that I was using the “Host’s name” instead “Host’s ID” as parameter.

                      Thanks so much

                      1 Reply Last reply Reply Quote 1
                      • M
                        MarkG
                        last edited by

                        I’m struggling somewhat with the format of the API requests

                        I know I can list all snapin associations with (assume I’m sending correct token headers, just for clarity)

                        curl  http://localhost/fog/snapinassociation
                        

                        and this returns

                        { "count": 1, "snapinassociations": [ { "id": "6135", "hostID": "52", "snapinID": "2484" } ]
                        

                        Now, what I want to do is to remove ALL snapins from hostID 52, but I can’t find a way to do this

                        The closest I’ve come is to do the above query, then parse the output and do

                         curl -X DELETE http://localhost/fog/snapinassociation/6135/delete
                        

                        But this feels clunky and I’m sure I’m missing something fundamental. The URIs aren’t quite making sense in my head, because I know I can create a snapin association with

                        curl  -X PUT -d '{"snapins":[2484]}' http://localhost/fog/host/52/edit
                        

                        but I can’t clear them with

                        curl  -X PUT -d '{"snapins":[]}' http://localhost/fog/host/52/edit
                        

                        What am I missing?

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

                          @MarkG What do you mean you can’t clear them?

                          After you run the curl -X PUT -d '{"snapins":[]}' http://localhost/fog/host/52/edit
                          What’s the output of:

                          curl -X GET http://localhost/fog/host/52

                          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
                          • M
                            MarkG
                            last edited by

                            @Tom-Elliott By “I can’t clear them” I mean that I’d expect sending an empty array would clear all snapin associations from that host, but it doesn’t, as evidenced by me looking in the FOG GUI and seeing the snapin association still there.

                            Here’s your GET command after my PUT with an empty array.

                            { "id": "52", "name": "HPProDesk", "description": "Created by FOG Reg on April 1, 2019, 2:19 pm", "ip": "", "imageID": "85", "building": "0", "createdTime": "2019-04-01 14:19:01", "deployed": "0000-00-00 00:00:00", "createdBy": "fog", "useAD": "", "ADDomain": "", "ADOU": "", "ADUser": "", "ADPass": "", "ADPassLegacy": "", "productKey": "", "printerLevel": "", "kernelArgs": "", "kernel": "", "kernelDevice": "", "init": "", "pending": "", "pub_key": "72c8515c7251f909e54b10ccfa26776a118fba25c333f7f9c3c3021c6d53e8f6", "sec_tok": "c3cd9236c7c2f3ea4d8f90e93b4b910179759f30af2cf47b4a3b3b2b24ea2afc6419d0ede3a0b465f354299c7a027999defd59bd11f93902382f3e827c8a3aa4", "sec_time": "2019-04-01 15:25:55", "pingstatus": "<i class=\"icon-ping-down fa fa-exclamation-circle red\" data-toggle=\"tooltip\" data-placement=\"right\" title=\"Connection timed out\"><\/i>", "biosexit": "grub", "efiexit": "refind_efi", "enforce": "", "primac": "a0:d3:c1:4e:49:45", "imagename": "HPProDesk_Win8_64_Pro_Prepped", "hostscreen": { "id": "", "hostID": "", "width": "", "height": "", "refresh": "", "orientation": "", "other1": "", "other2": "" }, "hostalo": { "id": "", "hostID": "", "time": "" }, "inventory": { "id": "50", "hostID": "52", "primaryUser": "fog", "other1": "", "other2": "", "createdTime": "2019-04-01 14:19:01", "deleteDate": "0000-00-00 00:00:00", "sysman": "Hewlett-Packard", "sysproduct": "HP ProDesk 405 G2 MT", "sysversion": "", "sysserial": "CZC43626MJ", "sysuuid": "8d1f307a-6b12-7ee0-d0c5-d2601e0e7c03", "systype": "Type: Desktop", "biosversion": "02.28", "biosvendor": "AMI", "biosdate": "09\/05\/2018", "mbman": "Hewlett-Packard", "mbproductname": "2240", "mbversion": "1.0", "mbserial": "CZC43626MJ", "mbasset": "CZC43626MJ", "cpuman": "AuthenticAMD", "cpuversion": "AMD A4-6250J APU with AMD Radeon R3 Graphics", "cpucurrent": "Current Speed: 2000 MHz", "cpumax": "Max Speed: 2000 MHz", "mem": "MemTotal: 3440588 kB", "hdmodel": "Hitachi HDS721616PLA380", "hdserial": "PVE331Z9RYDSZU", "hdfirmware": "P22OAB3A", "caseman": "Hewlett-Packard", "casever": "", "caseserial": "CZC43626MJ", "caseasset": "CZC43626MJ", "memory": "3.28 GiB" }, "image": { "imageTypeID": "1", "imagePartitionTypeID": "1", "id": "85", "name": "HPProDesk_Win8_64_Pro_Prepped", "description": "", "path": "HPProDesk_Win8_64_Pro_Prepped", "createdTime": "2018-11-21 09:49:17", "createdBy": "fog", "building": "0", "size": "366997504.000000:19634143232.000000:", "osID": "7", "deployed": "2018-11-21 12:15:29", "format": "0", "magnet": "", "protected": "0", "compress": "6", "isEnabled": "1", "toReplicate": "1", "srvsize": "4096", "os": {}, "imagepartitiontype": {}, "imagetype": {} }, "macs": [ "a0:d3:c1:4e:49:45" ]
                            
                            
                            Tom ElliottT 1 Reply Last reply Reply Quote 0
                            • Tom ElliottT
                              Tom Elliott @MarkG
                              last edited by

                              @MarkG What version of FOG are you running?

                              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
                              • M
                                MarkG
                                last edited by

                                @Tom-Elliott Sorry, should have mentioned that, 1.5.5

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

                                  @MarkG Might I ask you to update to working-1.6 branch?

                                  While I’m sure I could fix 1.5.x, @Sebastian-Roth has been working really well with it and that’s left me some time to focus my efforts towards completing 1.6 a little easier.

                                  I did make some interesting finds for 1.6 and they will likely translate fairly easily to 1.5 as well.

                                  I’m fairly confident that what I adjusted works a bit more proper for the adding/removing items now.

                                  In the past, initially, it was intended that you needed to send the item as you are: "snapins":[] but time and mindset were not my friends.

                                  If you’re not able to update to 1.6, I do understand. I just want to say the interface is 100% different from 1.5.x. Hopefully for the better!

                                  As far as stability goes, the backend is essentially identical to 1.5.x, as my main focus has been on fixing the GUI and making it as usable and functional as possible. With that, some changes have been introduced with regards to the API, and while I try to adjust and make additions into the 1.5.x when I make a 1.6 change to the API, some of the stuff will only work with 1.6.

                                  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
                                  • M
                                    MarkG
                                    last edited by

                                    @Tom-Elliott unfortunately this is in a production environment and we can’t currently afford the down time, but I appreciate your efforts and thanks for the reply - at least it has given me confidence that I’m not doing it “wrong”.

                                    As it happens I’m currently automating the entire FOG process by writing entries directly into the database and that is working fine for now, but I was looking at moving to the API as I’m sure it will be better for forwards compatibility - so when time allows I’l update my test server for 1.6 and work with that until we can update the production server.

                                    Thanks for the advice.

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

                                      I’ve updated the rout.class.php in 1.5.X branch (dev-branch)

                                      I will ask @MarkG if you would like to install this to see if it address what you need directly?

                                      I know you don’t want to move to the alpha build, but dev-branch is where the bug fixes found since 1.5.5 have been addressed.

                                      If anything, you can simply copy this dev-branches router class with:

                                      wget -O /var/www/fog/lib/router/route.class.php https://raw.githubusercontent.com/FOGProject/fogproject/489ba2952f5750e1483083eedade17dde6bb3cd8/packages/web/lib/router/route.class.php
                                      

                                      This should allow you to clear out items such as snapins with the code you were using:

                                      {
                                          "snapins": [],
                                          "printers": [1,2,3,4]
                                      }
                                      

                                      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
                                      • 1 / 1
                                      • First post
                                        Last post

                                      189

                                      Online

                                      12.0k

                                      Users

                                      17.3k

                                      Topics

                                      155.2k

                                      Posts
                                      Copyright © 2012-2024 FOG Project