Create a folder. Creates the folder /Halloween/emojis
curl -X POST https://api.dropboxapi.com/2/files/create_folder_v2 \
--header "Authorization: Bearer DROPBOX-ACCESS-TOKEN" \
--header "Content-Type: application/json" \
--data "{\"path\": \"/Halloween/emojis\",\"autorename\": false}"
Dim rest As Chilkat.Rest
Set rest = Chilkat.NewRest
' URL: https://api.dropboxapi.com/2/files/create_folder_v2
bTls = True
port = 443
bAutoReconnect = True
success = rest.Connect("api.dropboxapi.com",port,bTls,bAutoReconnect)
If (success <> True) Then
Debug.Print "ConnectFailReason: "; rest.ConnectFailReason
Debug.Print rest.LastErrorText
Exit Sub
End If
' See the Online Tool for Generating JSON Creation Code
Dim json As Chilkat.JsonObject
Set json = Chilkat.NewJsonObject
success = json.UpdateString("path","/Halloween/emojis")
success = json.UpdateBool("autorename",False)
success = rest.AddHeader("Authorization","Bearer DROPBOX-ACCESS-TOKEN")
success = rest.AddHeader("Content-Type","application/json")
Dim sbRequestBody As Chilkat.StringBuilder
Set sbRequestBody = Chilkat.NewStringBuilder
success = json.EmitSb(sbRequestBody)
Dim sbResponseBody As Chilkat.StringBuilder
Set sbResponseBody = Chilkat.NewStringBuilder
success = rest.FullRequestSb("POST","/2/files/create_folder_v2",sbRequestBody,sbResponseBody)
If (success <> True) Then
Debug.Print rest.LastErrorText
Exit Sub
End If
respStatusCode = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
Debug.Print "Response Status Code = "; respStatusCode
Debug.Print "Response Header:"
Debug.Print rest.ResponseHeader
Debug.Print "Response Body:"
Debug.Print sbResponseBody.GetAsString()
Exit Sub
End If
Dim jsonResponse As Chilkat.JsonObject
Set jsonResponse = Chilkat.NewJsonObject
success = jsonResponse.LoadSb(sbResponseBody)
' See the Online Tool for Generating JSON Parse Code
metadataName = jsonResponse.StringOf("metadata.name")
metadataId = jsonResponse.StringOf("metadata.id")
metadataPath_lower = jsonResponse.StringOf("metadata.path_lower")
metadataPath_display = jsonResponse.StringOf("metadata.path_display")
metadataSharing_infoRead_only = jsonResponse.BoolOf("metadata.sharing_info.read_only")
metadataSharing_infoParent_shared_folder_id = jsonResponse.StringOf("metadata.sharing_info.parent_shared_folder_id")
metadataSharing_infoTraverse_only = jsonResponse.BoolOf("metadata.sharing_info.traverse_only")
metadataSharing_infoNo_access = jsonResponse.BoolOf("metadata.sharing_info.no_access")
i = 0
count_i = jsonResponse.SizeOfArray("metadata.property_groups")
Do While i < count_i
jsonResponse.I = i
template_id = jsonResponse.StringOf("metadata.property_groups[i].template_id")
j = 0
count_j = jsonResponse.SizeOfArray("metadata.property_groups[i].fields")
Do While j < count_j
jsonResponse.J = j
name = jsonResponse.StringOf("metadata.property_groups[i].fields[j].name")
value = jsonResponse.StringOf("metadata.property_groups[i].fields[j].value")
j = j + 1
Loop
i = i + 1
Loop
{
"metadata": {
"name": "emojis",
"id": "id:a4ayc_80_OEAAAAAAAAAXz",
"path_lower": "/halloween/emojis",
"path_display": "/Halloween/emojis",
"sharing_info": {
"read_only": false,
"parent_shared_folder_id": "84528192421",
"traverse_only": false,
"no_access": false
},
"property_groups": [
{
"template_id": "ptid:1a5n2i6d3OYEAAAAAAAAAYa",
"fields": [
{
"name": "Security Policy",
"value": "Confidential"
}
]
}
]
}
}