There is no answer from the API, and the token seems to have worked for the upload, so I assume it should also work for the conversion immediately thereafter.
We are sorry for the inconvenience. We will update the documentation. Meanwhile, you can try following cURL command to convert USDZ to GLTF.
Convert USDZ to GLTF with Aspose.3D Converter API
# First get Access Token
# Get Customer Key and Customer ID from https://dashboard.aspose.cloud/
curl -X POST "https://api.aspose.cloud/connect/token"
-d "grant_type=client_credentials&client_id=xxxxx-xxxx-xxxx-xxxx-xxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxx"
-H "Content-Type: application/x-www-form-urlencoded"
-H "Accept: application/json"
# Upload File to Cloud Storage
curl -X PUT "https://api.aspose.cloud/v3.0/3d/storage/file/Temp/test.usdz"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "Content-Type: multipart/form-data"
-T "C:/Users/hp 840 g3/Downloads/test.usdz"
About the file conversion issue, please share your input document with us. We will try to replicate the issue and share our findings with you. You may test Aspose.3D Cloud right away in your browser with Web API Explorer. It provides a sample cURL command of API call as well.
Thanks for sharing the details. I have tested the UploadFile API method and PostConvertByFormat API method without any issue. However, please note PostConvertByFormat API method does not return any reply but saves the output document on storage. Please check your storage for the output file.
I have tested USDZ to GLTF conversion with your sample and got the following exception. So logged a ticket THREEDCLOUD-69 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.
"Error": {
"Code": "internalError",
"Message": "Stream incorrect or unsupported! Cannot open this file",
"Description": "Operation Failed. Internal error.",
"DateTime": "2022-02-17T16:46:40.9089302Z",
"InnerError": null
}
}
Hi @tilal.ahmad … in case you guys can’t resolve this issue quickly, perhaps you can tell me what’s different between your USDZ and my USDZ, and I can perhaps change my USDZs?
Just in the interest of being able to unblock my side…
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.
@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.
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!
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.
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.
{“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}}%
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.