I'm trying to generate a scene with the Autodesk AR/VR ToolKit, but I always get an error in the manifest, when all the requests are processed correctly.
{
"status": "failed",
"outputType": "arkit",
"children": [
{
"status": "failed",
"reason": "unknown",
"type": "resource",
"name": "taste2diegoda"
}
],
"progress": "complete"
}
]
}
The reason is always unknown and I have not found any information.
My object is a .IFC model and is hosted in a permanent bucket, I have obtained the urn from the Autodesk Vcode extension and the blog I am trying to follow is this:
https://aps.autodesk.com/blog/arvr-toolkit-refresher
To get the endpoints and the manifest I have used the following functions in python:
import base64
import requests
from requests.auth import HTTPBasicAuth
from config.params import *
import os
import json
- First I get a two-legged token:
def obtain_token_2_legged():
# URL de la solicitud POST
url = 'https://developer.api.autodesk.com/authentication/v2/token'
# Encabezados de la solicitud
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
'Authorization': f'Basic {global_id}'
}
# Datos del cuerpo de la solicitud
data = {
'grant_type': 'client_credentials',
'scope': f'{all_scope}'
}
# Realizar la solicitud POST
response = requests.post(url, headers=headers, data=data)
# Verificar el código de estado de la respuesta
if response.ok:
print("La solicitud POST fue exitosa.")
respuesta_json = response.json()
return respuesta_json['access_token']
else:
print("Error en la solicitud POST:", response.status_code)
print("Mensaje de error:", response.text)
return None
- With that token I create a scene:
def create_scene(token, urn, name_scene):
# URL de la solicitud PUT
url = f'https://developer-api-beta.autodesk.io/arkit/v1/{urn}/scenes/{name_scene}'
# Encabezados de la solicitud
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {token}'
}
# Cuerpo de la solicitud
data = {
'prj': {
'urn': f'{urn}'
}
}
# Realizar la solicitud PUT
response = requests.put(url, headers=headers, json=data)
# Verificar el código de estado de la respuesta
if response.status_code == 200:
print(f"La solicitud PUT para crear la escena {name_scene} fue exitosa.")
else:
print("Error en la solicitud PUT:", response.status_code)
print(response.text)
- Now I process the scene:
def process_scene(token, urn, scene):
# URL de la solicitud POST
url = 'https://developer-api-beta.autodesk.io/modelderivative/v2/arkit/job'
# Encabezados de la solicitud
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {token}'
}
# Datos del cuerpo de la solicitud
data = {
"input": {
"urn": f"{urn}"
},
"output": {
"formats": [{
"type": "arkit",
"scene": f"{scene}"
}]
}
}
# Realizar la solicitud POST
response = requests.post(url, headers=headers, json=data)
# Verificar el código de estado de la respuesta
if response.ok:
print("La solicitud POST para procesar el estado de la escena fue exitosa.")
print("Respuesta:", response.json())
else:
print("Error en la solicitud POST:", response.status_code)
print("Mensaje de error:", response.text)
- Scene Manifest
def manifest_scene(token, urn):
# URL de la solicitud GET
url = f'https://developer-api-beta.autodesk.io/modelderivative/v2/arkit/{urn}/manifest'
# Encabezados de la solicitud
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {token}'
}
# Realizar la solicitud GET
response = requests.get(url, headers=headers)
# Verificar el código de estado de la respuesta
if response.ok:
print("La solicitud GET para ver el estado de la escena fue exitosa.")
# Guarda la respuesta en un archivo JSON
with open('statuts_scene.json', 'w') as f:
json.dump(response.json(), f, indent=4)
print(f"El JSON se ha guardado en el archivo statuts_scene.json ")
else:
print("Error en la solicitud GET:", response.status_code)
print("Mensaje de error:", response.text)
All the requests come out correct but in step 4, when I review the response json I always see:
......
{
"status": "failed",
"outputType": "arkit",
"children": [
{
"status": "failed",
"reason": "unknown",
"type": "resource",
"name": "taste2diegoda"
}
],
"progress": "complete"
}
]
}