How to Convert USDZ to GLTF using cURL with Aspose.3D REST API?

I am really trying and trying and it still doesn’t work :frowning:

  1. Do I need a specific type of account?
  2. Can you send me the file you are trying with?
  3. Can there be any other reason why it works for you but not for me?
  4. Is there a way to find out an error message or an error log?
  5. Does it take a while to convert? If so, how long? Hours maybe?

Thanks a lot,
Christoph

@cburgdorfer

No, you do not need any specific account. The Free Trial plan provides all the functionalities and features except the 150 API monthly limit.

As shared in the private message. I’m able to convert your shared file using the following cURL command. Please check your cloud storage for the output and confirm

//Convert USDZ to GLTF
curl -X POST "https://api.aspose.cloud/v3.0/3d/saveas/newformat?name=framedpicture.usdz&newformat=gltf&newfilename=framedpicture.gltf&IsOverwrite=true" 
-H "accept: application/json" 
-H "authorization: Bearer [Access_Token]"

You may check your usage logs from your aspose.cloud dashboard.

It depends upon the file size/contents and network. However, it should be converted within seconds.

1 Like

@tilal.ahmad I have tried to use your codes and instructions verbatim, but the requests do not seem to reach your back end if I trigger them (can’t even see any of the requests in the log, while the others arrive).

Can you please confirm that you are not in some sort of VPN, have a whitelisted IP address, or anything of such nature?

I can see the requests works for you. But the exact same code (of course with the correct Bearer token) does not work if I try it from any of my servers, using curl on Mac or Linux.

Thanks,
Christoph

@cburgdorfer

No, I’m not using any VPN or some special arrangements. It is quite strange that the Upload File API request is working fine at your end but Conversion is failing.

Did you try the conversion from some other computer?

Can you please test the following C# code with your credentials using Aspose.3D Cloud NuGet Package and share the result?

using Aspose.ThreeD.Cloud.SDK.Api;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static String ClientId = "xxxxxx-xxxx-xxxx-xxxx-xxxxxxx";
        static String ClientSecret = "xxxxxxxxxxxxxxxxxxxx";


        static void Main(string[] args)
        {
            Convert_3d();
            Console.WriteLine("Completed...");
            Console.ReadKey();
        }
        public static void Convert_3d() {

            var threeDCloudApi = new ThreeDCloudApi("client_credentials", ClientId, ClientSecret);
            
            string name = "framedpicture.usdz";
            string newformat = "gltf2";
            string newfilename = "framedpicture.gltf";
            //string folder = "3DToPdf";
            bool isOverwrite = true;
            //string storage = "MyStorage";

            var response = threeDCloudApi.PostConvertByFormat(name, newformat, newfilename, null, isOverwrite, null);

        }
    }
}

Thanks @tilal.ahmad - yes I tried from multiple computers/servers with different OSes in different countries. None of them managed to trigger a /saveas command with cURL that shows in the activity log. The other commands showed in the activitiy logs (and worked).

Thanks for the C# code, I will try it and get back to you. Your help is much appreciated!

1 Like

By the way, I’ve found the solution. Your server seems to reject the request if the content length is 0 but the header doesn’t indicate that content length will be zero. Therefore adding the parameter -d "" to the cURL command seems to have solved the problem.

curl -v -d "" -X POST "https://api.aspose.cloud/v3.0/3d/saveas/newformat?name=framedpicture3.usdz&newformat=gltf&newfilename=framedpicture3.gltf&IsOverwrite=true" -H "accept: application/json" -H "authorization: Bearer ..."

Thanks again for your help! Much appreciated.

1 Like

@cburgdorfer

It is good to know that you have managed to resolve the issue. It might be the cURL version as the request calls are working fine with me without -d cURL parameter.

1 Like

@tilal.ahmad i tried the curl command by @cburgdorfer but i continuously get this error below:

{“RequestId”:“71492472-ae74-4d67-b5d0-d7034e83a01d”,“Error”:{“Code”:“internalError”,“Message”:“Stream incorrect or unsupported! Object reference not set to an instance of an object.”,“Description”:“Operation Failed. Internal error.”,“DateTime”:“2023-09-29T19:41:00.9035868Z”,“InnerError”:null}}%

@Octopus

The Conversion is working fine with my sample document. Please share your input document along with the sample code. We will look into the issue and guide you accordingly.

curl -v -d "" -X POST "https://api.aspose.cloud/v3.0/3d/saveas/newformat?name=framedpicture.usdz&newformat=gltf2&newfilename=framedpicture.gltf&IsOverwrite=true" -H "accept: application/json" -H "authorization: Bearer eyJhbGci.....goVD2wfKx6dvJuL7FmuvUg" 

my_test_file.usdz.zip (6.8 KB)
this is my test file.

@tilal.ahmad kindly find my test file here.my_test_file.usdz.zip (6.8 KB)

Kindly note that i zipped it in order to be able to share it with you, you can find the .usdz file in the .zip

1 Like

@Octopus

Thanks for sharing the input document. We have tested the scenario and noticed the reported issue with your shared file. So I logged a ticket(THREEDCLOUD-80) for further investigation and rectification. We will notify you as soon as it is resolved.

thank you very much for the swift response, my team and i will be on standby in other to deploy our app.

1 Like

@tilal.ahmad any update ?

@Octopus

I am afraid the issue is still pending for investigation in the queue. We will share an update/ETA with you as soon as the issue investigation is completed.

1 Like

are there alternative tools to ASPOSE ?
if yes kindly let me know @tilal.ahmad and @cburgdorfer

@Octopus

I am afraid I have no idea about alternate tools. You may Google the requirement. However, we will update you as soon as we fix the issue.

The support service this product makes this product unreliable.

@Octopus

We are truly sorry for the inconvenience. Actually, there are a number of apps and tools being used to create 3D files (USDZ), so the file structure of the same file format varies from one app/tool to another app/tool which causes problems in a file conversion app/tool. We have requested an update from our product team and will share it with you accordingly.