Introduction
Upload a mesh file from local system.
Upload Mesh
Request
Parameters
file OPTIONAL
type : file
in : form
description : Upload a zip file (containing obj, mtl and png) or a glb file
mesh_url OPTIONAL
type : string
in : body
description : Provide a zip url (containing obj, mtl and png) or a glb url
Notes
: Provide the URL to the GLB/Zip
file containing the mesh, or provide a file path to the mesh in your local file system.
Make sure the mesh being uploaded is in the same orientation as
this mesh.
POST /mesh-animation/upload
Code Snippets
Python : file upload
import requests
url = "https://api.csm.ai:5566/mesh-animation/upload"
payload = {}
files=[
('file',('filename',open('/path/to/file','rb'),'application/octet-stream'))
]
headers = {
'x-api-key': '<X-API_KEY>'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
Python : mesh url
import requests
import json
url = "https://api.csm.ai:5566/mesh-animation/upload"
payload = json.dumps({
"mesh_url": "https://example.com/file/mesh.glb"
})
headers = {
'x-api-key': '<X-API_KEY>',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Node.js : file upload
var request = require('request');
var fs = require('fs');
var options = {
'method': 'POST',
'url': 'https://api.csm.ai:5566/mesh-animation/upload',
'headers': {
'x-api-key': '<X-API_KEY>'
},
formData: {
'file': {
'value': fs.createReadStream('/path/to/file'),
'options': {
'filename': 'filename',
'contentType': null
}
}
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Node.js : mesh url
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.csm.ai:5566/mesh-animation/upload',
'headers': {
'x-api-key': '<X-API_KEY>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"mesh_url": "https://example.com/file/mesh.glb"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Curl : file upload
curl --location 'https://api.csm.ai:5566/mesh-animation/upload' \
--header 'x-api-key: <X-API_KEY>' \
--form 'file=@"/path/to/file"'
Curl : mesh url
curl --location 'https://api.csm.ai:5566/mesh-animation/upload' \
--header 'x-api-key: <X-API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"mesh_url":"https://example.com/file/mesh.glb"
}'
Response
{
"error": "",
"message": "Success",
"statusCode": 200,
"data": {
"session_code": "SESSION_17_7620_21332",
"mesh_url": "https://uploads/SESSION_17_7620_21332/mesh.glb",
"status": "init_processing"
}
}