FOG Project

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

    Solved Need a FOG API Call that works

    FOG Problems
    3
    4
    99
    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.
    • J
      jcargile last edited by

      I am trying to work through the Simplified API Documentation and have successfully implemented some GET calls to do things like ‘get all hosts’, ‘get active tasks’, etc…
      However, the last code snippet in the doc is for queuing a Task for Host #1 but ALL I get back is:

      {
          "error": "Invalid tasking type passed"
      }
      

      I have tried many different taskTypeID’s and always get the same result.
      I am running the curl command from a Linux terminal and also have converted it to an HTTP POST Request in PostMan… but nothing works!

      Does anyone have a working curl or http request to queue a Deploy Task for a specific host?
      Oh yeah, this is on FOG 1.5.7
      Thanks everyone!

      1 Reply Last reply Reply Quote 0
      • S
        Sebastian Roth Moderator last edited by Sebastian Roth

        @jcargile You might have shared the curl call you were using to see where the issue lies. Here is a working curl call to create a task that I just tested (pretty much derived from the Simplified API Documentation:

        curl --silent -k -H 'content-type: application/json' -H 'fog-user-token: UsErToKeN' -H 'fog-api-token: aPiToKeN' -X POST -d '{"taskTypeID":2,"shutdown": true}' http://fogserver/fog/host/1/task
        

        This means schedule an upload/capture task (ID 2) for my host #1.

        Search the forum for “fog-api-token” and you’ll find even more examples.

        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

        J 1 Reply Last reply Reply Quote 0
        • J
          jcargile @Sebastian Roth last edited by

          @Sebastian-Roth
          I have no idea what I was doing wrong here… My calls now work.

          1 Reply Last reply Reply Quote 0
          • S
            Sebastian Roth Moderator last edited by Sebastian Roth

            @jcargile You might have shared the curl call you were using to see where the issue lies. Here is a working curl call to create a task that I just tested (pretty much derived from the Simplified API Documentation:

            curl --silent -k -H 'content-type: application/json' -H 'fog-user-token: UsErToKeN' -H 'fog-api-token: aPiToKeN' -X POST -d '{"taskTypeID":2,"shutdown": true}' http://fogserver/fog/host/1/task
            

            This means schedule an upload/capture task (ID 2) for my host #1.

            Search the forum for “fog-api-token” and you’ll find even more examples.

            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

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

              You might want to check out these threads to see if there are any clues. TBH I’m not a programmer so you may have already found these

              https://forums.fogproject.org/topic/10036/api/4

              https://forums.fogproject.org/topic/12026/powershell-api-module/8

              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!

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

              148
              Online

              10.2k
              Users

              16.3k
              Topics

              149.9k
              Posts

              Copyright © 2012-2020 FOG Project