Unable to create folders with a parent

Hi all,

Am trying to create folders with the rest API but am unable to parent the folders to an existing folder ID. Folders keep gettng added to root.

Hierarchy I am trying to create Episode>Sequence>Shot

Is any one facing this? Any help appreciated.

Thank you

It would be great if you could share the rest api calls or code that is failing to work for you. That’d make it much easier to point out any mistakes an allow others to help.

Aside of that, @martin.wacker do you happen to have any REST API examples on how to create nested folder paths?

@BigRoy

Code and screenshots below:

# Create Episode folder
folders_endpoint = f"{ayon_server_url}/api/projects/{project}/folders"
response = httpx.post(
	folders_endpoint, 
	headers={
		"Authorization": f"Bearer {login_token}"
	},
	json={
		"name": "test_ep01",
		"label": "test_ep01",
		"folderType": "Episode",
		# "parentID": "",
		# "tags": [""],
		"attrib": { },
		"data": { },
		"active": "True",
	}

)

Details of created folder:

ID value from the above screenshot is being run in the snippet below

# Create Sequence folder
response = httpx.post(
    folders_endpoint, 
    headers={
        "Authorization": f"Bearer {login_token}"
    },
    json={
        "name": "test_sq01",
        "label": "test_sq01",
        "folderType": "Sequence",
        "parentID": "134fb0f51c3b11efb869eb423f7b6e47",
        # "tags": [""],
        "attrib": { },
        "data": { },
        "active": "True",
    }

)

Could you try with a lowercase d on parentId field. You seem to use parentID mistakenly?


More details

Here’s an example from the REST API docs of my AYON server for POST http://{server}/api/projects/{project_name}/folders

{
  "id": "c10d5bc73dcab7da4cba0f3e0b3c0aea",
  "name": "bush",
  "label": "bush",
  "folderType": "Asset",
  "parentId": "c10d5bc73dcab7da4cba0f3e0b3c0aea",
  "thumbnailId": "c10d5bc73dcab7da4cba0f3e0b3c0aea",
  "status": "In progress",
  "tags": [
    "flabadob",
    "blip",
    "blop",
    "blup"
  ],
  "attrib": {
    "fps": 25,
    "resolutionWidth": 1920,
    "resolutionHeight": 1080,
    "pixelAspect": 1,
    "clipIn": 1,
    "clipOut": 1,
    "frameStart": 1001,
    "frameEnd": 0,
    "handleStart": 0,
    "handleEnd": 0,
    "startDate": "2021-01-01T00:00:00+00:00",
    "endDate": "2021-01-01T00:00:00+00:00",
    "description": "A very nice entity",
    "tools": {
      "value": "htoa/6_2_5_2",
      "label": "Houdini to Arnold 6.2.5.2"
    }
  },
  "data": {},
  "active": true
}

Note that you can access these docs for your running AYON server instance directly from the web frontend:

image

This ensures you’re using the REST API docs that match your server version.

1 Like

Thanks @BigRoy

You/re right. Had mistakenly typed parentID instead of parentId that was causing the issue.

Fixed now.
Thank you.