I am working on an API that will pull folder ID’s and totals from the response data. Essentially, trying to make a loop work to count all of the items in a folder, but it needs to drill down into subfolders to get an accurate count.
The response body is as follows:
{
"data": [
{
"userId": 1416,
"creator": {
"id": 1416,
"name": "Brandon Cox",
"profileIcon": "42",
"email": "[email protected]"
},
"maxFileLifetime": 0,
"source": null,
"isShared": true,
"deleted": false,
"secure": false,
"type": "d",
"name": "Finance Co LLC",
"description": null,
"parentId": 164070,
"permalink": "https:",
"maxFolderExpiration": 0,
"created": "2023-04-11T14:33:12+0000",
"modified": "2023-04-11T14:33:18+0000",
"fileLifetime": 0,
"path": "API Test Docs/Finance Co LLC",
"permDeleted": false,
"syncable": false,
"id": 164153,
"expire": 0
},
{
"userId": 1416,
"creator": {
"id": 1416,
"name": "Brandon Cox",
"profileIcon": "42",
"email": "[email protected]"
},
"maxFileLifetime": 0,
"source": null,
"isShared": true,
"deleted": false,
"secure": false,
"type": "d",
"name": "GHA Insurance",
"description": null,
"parentId": 164070,
"permalink": "https://",
"maxFolderExpiration": 0,
"created": "2023-04-11T14:32:21+0000",
"modified": "2023-04-11T14:32:27+0000",
"fileLifetime": 0,
"path": "API Test Docs/GHA Insurance",
"permDeleted": false,
"syncable": false,
"id": 164120,
"expire": 0
},
{
"userId": 1416,
"creator": {
"id": 1416,
"name": "Brandon Cox",
"profileIcon": "42",
"email": "[email protected]"
},
"maxFileLifetime": 0,
"source": null,
"isShared": true,
"deleted": false,
"secure": false,
"type": "d",
"name": "Legal House",
"description": null,
"parentId": 164070,
"permalink": "https://",
"maxFolderExpiration": 0,
"created": "2023-04-11T14:32:58+0000",
"modified": "2023-04-11T14:32:59+0000",
"fileLifetime": 0,
"path": "API Test Docs/Legal House",
"permDeleted": false,
"syncable": false,
"id": 164142,
"expire": 0
},
{
"userId": 1416,
"creator": {
"id": 1416,
"name": "Brandon Cox",
"profileIcon": "42",
"email": "[email protected]"
},
"maxFileLifetime": 0,
"source": null,
"isShared": true,
"deleted": false,
"secure": false,
"type": "d",
"name": "MFT_Test",
"description": null,
"parentId": 164070,
"permalink": "https:1",
"maxFolderExpiration": 0,
"created": "2023-04-11T14:33:04+0000",
"modified": "2023-04-11T14:33:05+0000",
"fileLifetime": 0,
"path": "API Test Docs/MFT_Test",
"permDeleted": false,
"syncable": false,
"id": 164147,
"expire": 0
},
{
"userId": 1416,
"creator": {
"id": 1416,
"name": "Brandon Cox",
"profileIcon": "42",
"email": "[email protected]"
},
"maxFileLifetime": 0,
"source": null,
"isShared": true,
"deleted": false,
"secure": false,
"type": "d",
"name": "New Hire Docs",
"description": null,
"parentId": 164070,
"permalink": "https://",
"maxFolderExpiration": 0,
"created": "2023-04-11T14:33:19+0000",
"modified": "2023-04-11T14:33:19+0000",
"fileLifetime": 0,
"path": "API Test Docs/New Hire Docs",
"permDeleted": false,
"syncable": false,
"id": 164175,
"expire": 0
},
],
"metadata": {
"limit": null,
"offset": null,
"totalDeletedFilesCount": 0,
"totalDeletedFoldersCount": 0,
"total": 9
}
}
So this is pulling info about the parent folder. The “total” at the bottom is the number I need to COUNT with, and each folder has an “id” that needs to be pulled for a loop so the folder can be looked into and have its “total” pulled.
I have zero idea of where to go for this. Any and all guidance is much appreciated!