22 Sep 2017

Tutorial cURL Create Folder for BIM360 Docs

Default blog image

Today I will share the steps I take using cURL to achieve the creation of a folder in BIM 360 Docs with the use of the Forge Data Management and BIM 360 API.

These steps will do use of Authentication, BIM360 API and Data Management Command. 

The steps we will take will be the following. 

  1. GET call to the Authentication API to obtain a 2 legged Token
  2. GET call to obtain detail of which Hubs do we have access in BIM 360 Docs (Registration of APP required for BIM 360 API access)
  3. GET call to find the project that has your resource
  4. GET call to the BIM360 API to obtain User ID value
  5. GET call to find the folder where the creation of the folder will happen (Plans, Project File, Drawings).
    1. Extra step can include the access to a sub-folder.
  6. POST call to the Create Folder command which will be hosted in the previously defined folder

Let's get started. I will be using the same structure for the cURL commands stated in the documentation, I will be providing links to the locations of every call I make. 

We will start with the authentication in order to obtain our access token.  We need to make sure we set the right scopes since we will be creating folders, accessing user information and creating data. More about Scopes here. Our token will need the data:write data:create for creating our folder and account:read to obtain the user information from BIM360 API. 

Let's use it in our terminal and let's see our returned response. 

curl --request POST \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'client_id=xxxxxxebzXkg2Cta5M0eKl03xxxxxx&client_secret=xxxxxxCHwdjdGxxxx&grant_type=client_credentials&scope=data%3Awrite%20data%3Acreate%20account%3Aread%20' https://developer.api.autodesk.com/authentication/v1/authenticate \ | jq '.'

{
  "access_token": "eyJhbGciOiJIUzI1NiIsIxxxxxxxxxxxxxyaWNfa2V5In0.eyJjbGllbnRfaWQiOiIxZ3NibU9zZWJ6WGtnMkN0YTVNMGVLbDAzTm1TencxdCIsImV4cCI6MTUwNjExNTA2Nywic2NvcGUiOlsiZGF0YTp3cml0ZSIsImRhdGE6Y3JlYXRlIiwiYWNjb3VudDpyZWFkIl0sImF1ZCI6Imh0dHBzOi8vYXV0b2Rlc2suY29tL2F1ZC9qd3RleHA2MCIsImp0aSI6ImtXdTBjSE1TczlsbFBhWUZ3V3cyT1dvNldYZnlVdDdiRGt1RUwxamFEMjZnZzJEWm1FM2JWbjIwRElnTDlMQmEifQ.ICrFMKglnia5xc6jDuEkoyILbSCYSVrsipTOLfk3Rqo",
  "token_type": "Bearer",
  "expires_in": 3599
}

We will use now the access_token value to be passed in all our calls. In order to not have to copying and pasting the long length of our token in all subsequent calls, we will export it to one of our bash variables.

Type the following in your terminal

export FORGE_ACCESS_TOKEN=YOURTOKEN

Now we have stored the value of our token inside of a bash variable to be use in the rest of our calls. The next step will be to obtain back a list of the available Hubs our user has access to it. You can check this from the UI of the Team services products and the BIM 360 Docs Projects your key has been registered with. Check here in case you missed the link reference above. 

//Step 2: Find the hub that has your resource

curl -X 'GET' -H 'Authorization: Bearer '$FORGE_ACCESS_TOKEN'' 'https://developer.api.autodesk.com/project/v1/hubs' | jq '.'
// Response 

{
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": {
      "href": "https://developer.api.autodesk.com/project/v1/hubs"
    }
  },
  "data": [
    {
      "type": "hubs",
      "id": "b.e6d7a065-e57d-4abc-89c3-caf859bxxxxx",
      "attributes": {
        "name": "Autodesk2016-02-01 19:02:43 UTC",
        "extension": {
          "type": "hubs:autodesk.bim360:Account",
          "version": "1.0",
          "schema": {
            "href": "https://developer.api.autodesk.com/schema/v1/versions/hubs:autodesk.bim360:Account-1.0"
          },
          "data": {}
        }
      },
      "links": {
        "self": {
          "href": "https://developer.api.autodesk.com/project/v1/hubs/b.e6d7a065-e57d-4abc-89c3-caf859bxxxxx"
        }
      },
      "relationships": {
        "projects": {
          "links": {
            "related": {
              "href": "https://developer.api.autodesk.com/project/v1/hubs/b.e6d7a065-e57d-4abc-89c3-caf859bxxxxx/projects"
            }
          }
        }
      }
    }
  ],
  "meta": {
    "warnings": [
      {
        "Id": null,
        "HttpStatusCode": "403",
        "ErrorCode": "BIM360DM_ERROR",
        "Title": "Unable to get hubs from BIM360DM EMEA.",
        "Detail": "You don't have permission to access this API",
        "AboutLink": null,
        "Source": [],
        "meta": []
      }
    ]
  }
}

As we can see in the response above, We get back all the HUBS in the Team Service that we are part of and also all the BIM 360 Docs ones, an easy and fast way to identify the BIM 360 Docs ones is by looking for the Id that begins with the letter "b"

This Id is similar to our account ID from the registration to the BIM 360 API Integration b.a4f95080-84fe-4281-8d0a-bd8c88xxxxxx.

//Step 3: Find the project that has your resource

curl -X GET -H 'Authorization: Bearer '$FORGE_ACCESS_TOKEN'' 'https://developer.api.autodesk.com/project/v1/hubs/b.a4f95080-84fe-4281-8d0a-bd8c88xxxxxx/projects' | jq '.'


//Response

{
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": {
      "href": "https://developer.api.autodesk.com/project/v1/hubs/b.a4f95080-84fe-4281-8d0a-bd8c885695e0/projects"
    }
  },
  "data": [
    {
      "type": "projects",
      "id": "b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274",
      "attributes": {
        "name": "Docs Jaime access",
        "extension": {
          "type": "projects:autodesk.bim360:Project",
          "version": "1.0",
          "schema": {
            "href": "https://developer.api.autodesk.com/schema/v1/versions/projects:autodesk.bim360:Project-1.0"
          },
          "data": {}
        }
      },
      "links": {
        "self": {
          "href": "https://developer.api.autodesk.com/project/v1/hubs/b.a4f95080-84fe-4281-8d0a-bd8c88xxxxxx/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274"
        }
      },
      "relationships": {
        "hub": {
          "data": {
            "type": "hubs",
            "id": "b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274"
          },
          "links": {
            "related": {
              "href": "https://developer.api.autodesk.com/project/v1/hubs/b.a4f95080-84fe-4281-8d0a-bd8c88xxxxxx"
            }
          }
        },
        "rootFolder": {
          "data": {
            "type": "folders",
            "id": "urn:adsk.wipprod:fs.folder:co.uQvUKg5SRiewt2ZjUrtmcg"
          },
          "meta": {
            "link": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.uQvUKg5SRiewt2ZjUrtmcg"
            }
          }
        },
        "topFolders": {
          "links": {
            "related": {
              "href": "https://developer.api.autodesk.com/project/v1/hubs/b.a4f95080-84fe-4281-8d0a-bd8c88xxxxxx/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/topFolders"
            }
          }
        }
      }
    }
  ]
}

Since we are using a 2 legged token, in order to create a folder the command asks for the x-user-id header. We can obtain this by making a call to the GET Users endpoint on the BIM360 API. Here is how the call look. 

curl --request GET \
  --header 'authorization: Bearer '$FORGE_ACCESS_TOKEN'' \
  https://developer.api.autodesk.com/hq/v1/accounts/a4f95080-84fe-4281-8d0a-bd8c88xxxxxx/users \ | jq '.'


  {
    "id": "49cd8851-fc8a-456b-b6cc-24071dxxxxxx",
    "email": "jaime.rosalesxxxxx@autodesk.com",
    "name": "Jaime Rosales",
    "nickname": "rosalesxxxxx",
    "first_name": "Jaime",
    "last_name": "Rosales",
    "uid": "TNSUM9VPXXXX",
    "image_url": "https://s3.amazonaws.com:443/com.autodesk.storage.public.production/oxygen/TNSUM9VPXXXX/profilepictures/x50.jpg?r=0",
    "address_line_1": null,
    "address_line_2": null,
    "city": null,
    "postal_code": null,
    "state_or_province": "New York",
    "country": "United States",
    "phone": "",
    "company": null,
    "job_title": "Senior Developer Consultant",
    "industry": "Software Development",
    "about_me": "Jaime Rosales is a Senior Developer Consultant since July 2014 for the Autodesk Developer Network and Forge Development Partner Program.  He joined Autodesk in 2011 through the acquisition of Horizontal Systems: the company that developed the cloud-based collaboration systems—now known as BIM 360 Glue (the Glue). He was responsible for developing all the add-ins for BIM 360 Glue, using the API’s of various AEC desktop products.  He is currently empowering customers with the use of Autodesk Forge platform, through the world with hosted events such as Cloud Accelerators, AEC Hackathons, VR & AR Hackathons.. He spends part of his time presenting in different parts of the US, Europe and Latin America about the implementation of 3D content for web applications through the JS and NodeJS communities.",
    "created_at": "2015-08-20T02:11:31.086Z",
    "updated_at": "2017-09-22T19:39:44.569Z",
    "account_id": "e6d7a065-e57d-4abc-89c3-caf859xxxxx",
    "role": "account_admin",
    "status": "active",
    "company_id": "3a28416d-fb3f-44e0-b098-3f35f6xxxxx",
    "company_name": "Autodesk",
    "last_sign_in": "2017-09-22T15:47:49.000Z"
  }

From the response the value that we will need in our Create Folder command is the UID value. 

After getting the list of Projects and the UID successfully, now we can get the list of Folders inside of our BIM 360 Docs Project and specify the location for creating our new folder, we are not allow to create or upload at the root level folder, that is why we need to choose a folder.

// Step 5: Get Folder 
// We pass in the ProjectID and the Root Folder ID in the following End Point.

curl -X GET -H 'Authorization: Bearer '$FORGE_ACCESS_TOKEN'' 'https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn%3Aadsk.wipprod%3Afs.folder%3Aco.uQvUKg5SRiewt2ZjUrtmcg/contents' | jq '.'

// Response

{
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": {
      "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.uQvUKg5SRiewt2ZjUrtmcg/contents"
    }
  },
  "data": [
    {
      "type": "folders",
      "id": "urn:adsk.wipprod:fs.folder:co.4Gx-9UIlRb-0SQrMr37tjw",
      "attributes": {
        "name": "Photos",
        "displayName": "Photos",
        "createTime": "2017-04-11T17:33:32.0000000Z",
        "createUserId": "",
        "createUserName": "",
        "lastModifiedTime": "2017-04-11T17:33:32.0000000Z",
        "lastModifiedUserId": "",
        "lastModifiedUserName": "",
        "objectCount": 0,
        "hidden": false,
        "extension": {
          "type": "folders:autodesk.bim360:Folder",
          "version": "1.0",
          "schema": {
            "href": "https://developer.api.autodesk.com/schema/v1/versions/folders:autodesk.bim360:Folder-1.0"
          },
          "data": {
            "allowedTypes": [
              "items:autodesk.bim360:File",
              "folders:autodesk.bim360:Folder"
            ],
            "visibleTypes": [
              "items:autodesk.bim360:File"
            ]
          }
        }
      },
      "links": {
        "self": {
          "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.4Gx-9UIlRb-0SQrMr37tjw"
        }
      },
      "relationships": {
        "contents": {
          "links": {
            "related": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.4Gx-9UIlRb-0SQrMr37tjw/contents"
            }
          }
        },
        "parent": {
          "data": {
            "type": "folders",
            "id": "urn:adsk.wipprod:fs.folder:co.uQvUKg5SRiewt2ZjUrtmcg"
          },
          "links": {
            "related": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.4Gx-9UIlRb-0SQrMr37tjw/parent"
            }
          }
        },
        "refs": {
          "links": {
            "self": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.4Gx-9UIlRb-0SQrMr37tjw/relationships/refs"
            },
            "related": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.4Gx-9UIlRb-0SQrMr37tjw/refs"
            }
          }
        },
        "links": {
          "links": {
            "self": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.4Gx-9UIlRb-0SQrMr37tjw/relationships/links"
            }
          }
        }
      }
    },
    {
      "type": "folders",
      "id": "urn:adsk.wipprod:fs.folder:co.7ISq_WHERfKOfShXZDFDYw",
      "attributes": {
        "name": "Plans",
        "displayName": "Plans",
        "createTime": "2017-04-11T17:33:32.0000000Z",
        "createUserId": "",
        "createUserName": "",
        "lastModifiedTime": "2017-04-17T18:06:45.0000000Z",
        "lastModifiedUserId": "TNSUM9VPW79S",
        "lastModifiedUserName": "Jaime%20Rosales",
        "objectCount": 5,
        "hidden": false,
        "extension": {
          "type": "folders:autodesk.bim360:Folder",
          "version": "1.0",
          "schema": {
            "href": "https://developer.api.autodesk.com/schema/v1/versions/folders:autodesk.bim360:Folder-1.0"
          },
          "data": {
            "allowedTypes": [
              "folders:autodesk.bim360:Folder",
              "items:autodesk.bim360:File",
              "items:autodesk.bim360:Document",
              "items:autodesk.bim360:TitleBlock",
              "items:autodesk.bim360:ReviewDocument"
            ],
            "actions": [
              "CONVERT",
              "SPLIT",
              "OCR"
            ],
            "visibleTypes": [
              "items:autodesk.bim360:Document"
            ]
          }
        }
      },
      "links": {
        "self": {
          "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.7ISq_WHERfKOfShXZDFDYw"
        }
      },
      "relationships": {
        "contents": {
          "links": {
            "related": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.7ISq_WHERfKOfShXZDFDYw/contents"
            }
          }
        },
        "parent": {
          "data": {
            "type": "folders",
            "id": "urn:adsk.wipprod:fs.folder:co.uQvUKg5SRiewt2ZjUrtmcg"
          },
          "links": {
            "related": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.7ISq_WHERfKOfShXZDFDYw/parent"
            }
          }
        },
        "refs": {
          "links": {
            "self": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.7ISq_WHERfKOfShXZDFDYw/relationships/refs"
            },
            "related": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.7ISq_WHERfKOfShXZDFDYw/refs"
            }
          }
        },
        "links": {
          "links": {
            "self": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.7ISq_WHERfKOfShXZDFDYw/relationships/links"
            }
          }
        }
      }
    },
    {
      "type": "folders",
      "id": "urn:adsk.wipprod:fs.folder:co.pZoSnUcoR1eJQu_PRyvfeg",
      "attributes": {
        "name": "Project Files",
        "displayName": "Project Files",
        "createTime": "2017-04-11T17:33:33.0000000Z",
        "createUserId": "",
        "createUserName": "",
        "lastModifiedTime": "2017-04-11T17:33:33.0000000Z",
        "lastModifiedUserId": "",
        "lastModifiedUserName": "",
        "objectCount": 0,
        "hidden": false,
        "extension": {
          "type": "folders:autodesk.bim360:Folder",
          "version": "1.0",
          "schema": {
            "href": "https://developer.api.autodesk.com/schema/v1/versions/folders:autodesk.bim360:Folder-1.0"
          },
          "data": {
            "allowedTypes": [
              "items:autodesk.bim360:File",
              "folders:autodesk.bim360:Folder"
            ],
            "actions": [
              "CONVERT"
            ],
            "visibleTypes": [
              "items:autodesk.bim360:File"
            ]
          }
        }
      },
      "links": {
        "self": {
          "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.pZoSnUcoR1eJQu_PRyvfeg"
        }
      },
      "relationships": {
        "contents": {
          "links": {
            "related": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.pZoSnUcoR1eJQu_PRyvfeg/contents"
            }
          }
        },
        "parent": {
          "data": {
            "type": "folders",
            "id": "urn:adsk.wipprod:fs.folder:co.uQvUKg5SRiewt2ZjUrtmcg"
          },
          "links": {
            "related": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.pZoSnUcoR1eJQu_PRyvfeg/parent"
            }
          }
        },
        "refs": {
          "links": {
            "self": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.pZoSnUcoR1eJQu_PRyvfeg/relationships/refs"
            },
            "related": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.pZoSnUcoR1eJQu_PRyvfeg/refs"
            }
          }
        },
        "links": {
          "links": {
            "self": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.pZoSnUcoR1eJQu_PRyvfeg/relationships/links"
            }
          }
        }
      }
    },
    {
      "type": "folders",
      "id": "urn:adsk.wipprod:fs.folder:co.OXRxgLMvSQWdQW_ILyF4OQ",
      "attributes": {
        "name": "ProjectTb",
        "displayName": "ProjectTb",
        "createTime": "2017-04-11T17:33:33.0000000Z",
        "createUserId": "",
        "createUserName": "",
        "lastModifiedTime": "2017-04-17T18:09:22.0000000Z",
        "lastModifiedUserId": "TNSUM9VPW79S",
        "lastModifiedUserName": "Jaime%20Rosales",
        "objectCount": 1,
        "hidden": false,
        "extension": {
          "type": "folders:autodesk.bim360:Folder",
          "version": "1.0",
          "schema": {
            "href": "https://developer.api.autodesk.com/schema/v1/versions/folders:autodesk.bim360:Folder-1.0"
          },
          "data": {
            "allowedTypes": [
              "items:autodesk.bim360:TitleBlock"
            ]
          }
        }
      },
      "links": {
        "self": {
          "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.OXRxgLMvSQWdQW_ILyF4OQ"
        }
      },
      "relationships": {
        "contents": {
          "links": {
            "related": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.OXRxgLMvSQWdQW_ILyF4OQ/contents"
            }
          }
        },
        "parent": {
          "data": {
            "type": "folders",
            "id": "urn:adsk.wipprod:fs.folder:co.uQvUKg5SRiewt2ZjUrtmcg"
          },
          "links": {
            "related": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.OXRxgLMvSQWdQW_ILyF4OQ/parent"
            }
          }
        },
        "refs": {
          "links": {
            "self": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.OXRxgLMvSQWdQW_ILyF4OQ/relationships/refs"
            },
            "related": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.OXRxgLMvSQWdQW_ILyF4OQ/refs"
            }
          }
        },
        "links": {
          "links": {
            "self": {
              "href": "https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/folders/urn:adsk.wipprod:fs.folder:co.OXRxgLMvSQWdQW_ILyF4OQ/relationships/links"
            }
          }
        }
      }
    }
  ]
}

If you have a subfolder you will like to to the upload, you can repeat the step above by exploring the content of the folder where you have the subfolder by replacing the Folder ID with the location where it is.

Now that we have the value of our folder, in this case we will create folders inside of the "Project Files" folder. We will use now the Data Management Command "Create Folder" if you want to learn more about this command go here.

Here is how the call will look

curl -X POST \
 -H 'authorization: Bearer '$FORGE_ACCESS_TOKEN'' \
 -H 'cache-control: no-cache' \
 -H 'content-type: application/vnd.api+json' \
 -H 'x-user-id: TNSUM9VPXXXX' \
 -d '{ jsonapi: {
     "version": "1.0"
   },
   "data": {
        "type": "commands",
        "attributes": {
            "extension": {
                "type": "commands:autodesk.core:CreateFolder",
                "version": "1.0.0",
                "data": {
                "requiredAction": "create"
                }
            }
        },
        "relationships": {
            "resources": {
                "data": [{
                    "type": "folders",                
                    "id": "1"
                }
                ]
            }
        }
   },
   "included": [{
           "type": "folders",
           "id": "1",
           "attributes": {
               "name": "blogtutorialTest",
               "extension": {
                    "type": "folders:autodesk.bim360:Folder",
                    "version": "1.0"
               }
           },
           "relationships": {
               "parent": {
                   "data": {
                       "type": "folders",
                       "id": "urn:adsk.wipprod:fs.folder:co.YOURFOLDERID"
                   }
               }
           }
       }
   ]
}' https://developer.api.autodesk.com/data/v1/projects/b.ab37405e-xxxx-xxxx-xxxx-7a1a681d3274/commands \ | jq '.'



{
  "jsonapi": {
    "version": "1.0"
  },
  "data": {
    "type": "commands",
    "id": "xxxxxxx-014d-482c-a957-2b52226460f3",
    "attributes": {
      "extension": {
        "type": "commands:autodesk.core:CreateFolder",
        "version": "1.0",
        "schema": {
          "href": "https://developer.api.autodesk.com/schema/v1/versions/commands:autodesk.core:CreateFolder-1.0.0"
        }
      },
      "status": "completed"
    },
    "relationships": {
      "resources": {
        "data": [
          {
            "type": "folders",
            "id": "urn:adsk.wipprod:fs.folder:co.XxxXXNSGaNebgN2Cr6ug"
          }
        ]
      },
      "created": {
        "data": [
          {
            "type": "folders",
            "id": "urn:adsk.wipprod:fs.folder:co.xxXXxxNSGaNebgN2Cr6ug"
          }
        ]
      }
    }
  }
}

And here is the proof of the recently created folder "blogtutorialTest" in BIM 360 Docs.

docs folder

Thank you for reading and until next time.

Related Article