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

    Fog api image create 417 error

    FOG Problems
    2
    4
    107
    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
      maddyred last edited by

      Hi i’m unable to create fog image from api Please find my json body
      data = {
      “name”: “fogsvos”,
      “description”: “”,
      “path”: “SVOSTEST”,
      “imagetypename”: “Single Disk - Resizable”,
      “imageparttypename”: “Everything”,
      “osname”: “Linux”,
      “storagegroupname”: “default”
      }
      please let me know if anything missing in json body

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

        @maddyred Finally found some time to look into this. Not sure where you got some of data field names from. You better take a look at the code. Here you find the reference to the fields used for images: https://github.com/FOGProject/fogproject/blob/dev-branch/packages/web/lib/fog/image.class.php#L35

        Just below that your also find the defintion of databaseFieldsRequired (for images) - you need at least those four to be able to create an image defintion: name, path, imageTypeID, osID

        Here is an example with some more fields that worked on my tests:

        ...
        data = {
          "name": "fogsvos",
          "description": "API created image",
          "path": "/images/fogsvos",
          "imageTypeID": 1,              # Single Disk - Resizable
          "imagePartitionTypeID": 1,     # Everything
          "osID": 50,                    # Linux
          "format": "5",                 # Partclone Zstd
          "protected": 0,
          "compress": 9,
          "isEnabled": 1,
          "toReplicate": 1,
        }
        ...
        

        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
          maddyred @Sebastian Roth last edited by

          @sebastian-roth data = {
          “name”: “fogsvos”,
          “description”: “”,
          “path”: “SVOSTEST”,
          “imagetypename”: “Single Disk - Resizable”,
          “imageparttypename”: “Everything”,
          “osname”: “Linux”,
          “storagegroupname”: “default”,
          “format”: “5”,
          “magnet”: “”,
          “protected”: “0”,
          “compress”: “6”,
          “isEnabled”: “1”,
          “toReplicate”: “1”,
          “srvsize”: “1633196522”
          }
          response = session.post(url + ‘/fog/image/create’,data=json.dumps(data))
          print(response.text)
          print(response.status_code)

          python used for api call

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

            @maddyred What tool do you use to do the API call and what error do you see?

            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

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

            105
            Online

            10.4k
            Users

            16.4k
            Topics

            150.7k
            Posts

            Copyright © 2012-2023 FOG Project