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

Fog api image create 417 error

Scheduled Pinned Locked Moved
FOG Problems
2
4
510
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 Nov 10, 2021, 5:35 AM

    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 Nov 10, 2021, 11:47 AM

      @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 Nov 17, 2021, 3:56 AM Reply Quote 0
      • M
        maddyred @Sebastian Roth
        last edited by Nov 17, 2021, 3:56 AM

        @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 Sebastian Roth Nov 23, 2021, 9:50 AM Nov 23, 2021, 3:50 PM

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

          226

          Online

          12.0k

          Users

          17.3k

          Topics

          155.2k

          Posts
          Copyright © 2012-2024 FOG Project