autodesk-forgeautodesk-data-management

Autodesk Platform Services - Data Management - Upload first version error


Similar issue to this post However, the solution does not resolve my issue. I'm following the step-by-step instructions listed here and everything is working well until I get to step 7 (Create first version of the uploaded file). I'm not sure that I need to perform this step for a successful upload because it is not listed anywhere here. Since I'm not seeing my file appear in my folder, I'm thinking that the first version step must be necessary.

This is the request body that I'm using:

string requestBody = @"
        {
            ""jsonapi"": { ""version"": ""1.0"" },
            ""data"": {
                ""type"": ""items"",
                ""attributes"": {
                    ""displayName"": """ + fileName + @""",
                    ""extension"": {
                        ""type"": ""items:autodesk.bim360:File"",
                        ""version"": ""1.0""
                    }
                },
                ""relationships"": {
                    ""tip"": {
                        ""data"": {
                            ""type"": ""versions"", 
                            ""id"": ""1""
                        }
                    },
                    ""parent"": {
                        ""data"": {
                            ""type"": ""folders"",
                            ""id"": """ + folderId + @"""
                        }
                    }
                }
            },
            ""included"": [
                {
                    ""type"": ""versions"",
                    ""id"": ""1"",
                    ""attributes"": {
                        ""name"": """ + fileName + @""",
                        ""extension"": {
                            ""type"": ""versions:autodesk.bim360:File"",
                            ""version"": ""1.0""
                        }
                    },
                    ""relationships"": {
                        ""storage"": {
                            ""data"": {
                                ""type"": ""objects"",
                                ""id"": """ + objectId + @"""
                            }
                        }
                    }
                }
            ]
        }";

which translates to :

    {
        "jsonapi": { "version": "1.0" },
        "data": {
            "type": "items",
            "attributes": {
                "displayName": "ACCUploadTest8.log",
                "extension": {
                    "type": "items:autodesk.bim360:File",
                    "version": "1.0"
                }
            },
            "relationships": {
                "tip": {
                    "data": {
                        "type": "versions", 
                        "id": "1"
                    }
                },
                "parent": {
                    "data": {
                        "type": "folders",
                        "id": "urn:Aadsk.wipprod:Afs.folder:Aco.CdqHiUXsTUaXBnE6Iwxb8g"
                    }
                }
            }
        },
        "included": [
            {
                "type": "versions",
                "id": "1",
                "attributes": {
                    "name": "ACCUploadTest8.log",
                    "extension": {
                        "type": "versions:autodesk.bim360:File",
                        "version": "1.0"
                    }
                },
                "relationships": {
                    "storage": {
                        "data": {
                            "type": "objects",
                            "id": "urn:adsk.objects:os.object:wip.dm.prod/b1333e7c-39ae-41e4-a94e-e0c3c3c87c58.log"
                        }
                    }
                }
            }
        ]
    }

This is the response that I'm receiving:

{"jsonapi":{"version":"1.0"},"errors":[{"id":"129d054e-6da7-4bbc-a04d-e220e7043466","status":"400","code":"BAD_INPUT","title":"One or more input values in the request were bad","detail":"Urn is not in the proper format."}]}

Solution

  • Silly mistake. It turns out that I did not properly decode my folder id url. HttpUtility.UrlDecode()