• 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

  • Moderator

    @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,
    }
    ...
    

  • @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

  • Moderator

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

303
Online

9.0k
Users

15.6k
Topics

145.1k
Posts