Hi @tribble42!
I’ve used the updated API, it works great now. Thank you for all your help!
Somehow still experiencing issues with authentication and updating models:
uid=’{“detail”:“Method “PUT” not allowed.”}’
Sample (BASH):
update () {
curl -# -k -X PUT
-H ‘Content-Type: multipart/form-data’
-H ‘Accept: application/json’
-H “Authorization: Token ${token}”
-F “modelFile=@${file}”
-F “name=${filename}”
-F “description=${description}”
-F “password=${password}”
-F “private=${private}”
-F “tags=${tags}”
‘https://api.sketchfab.com/v3/models’ > “${id_file}”
}
where $id_file designates uploaded and existing models in my account.
I believe you need to use POST on https://api.sketchfab.com/v3/models
for upload.
If you want to re-upload, you must use PUT, but on the https://api.sketchfab.com/v3/models/{uid}
endpoint (where {uid}
is the uid of the model to be replaced)
https://docs.sketchfab.com/data-api/v3/index.html#!/models/put_v3_models_uid
I’ve managed to figure it out for the re-upload - thank you.
Couple more things now:
Any EASY way to get the model UID back (new or updated)?
Any EASY way to get the status for the model processing?
I say easy because one needs to fetch, parse and stream edit the status page at api.sketchfab.com/i/models/uid
Why not have api.sketchfab.com/i/models/status/uid and api.sketchfab.com/i/models/identity/uid that only return the necessary strings?
thanks
An upload POST should return the new UID.
A re-upload PUT will not change the UID, so you should already have it.
GET https://api.sketchfab.com/v3/models/UID and parsing response.status.processing
doesn’t seem any harder than fetching a different endpoint.
If you are using bash, you should probably have a look at json parsing tools like jq .
jq lets you use selectors to extract data from a json structure. For example:
$curl -s https://api.sketchfab.com/v3/models/45f6018a79584240a6ada38f7fa94d44 | jq '.status.processing'
would return the
"SUCCEEDED"
Also note that you should always use the /v3/, and never use /i/ which is reserved for internal use.
I need a real time status update.
For some reason, while re-uploading a model, the status stays stuck to “SUCCEEDED” rather than showing ‘processing’ as intended (on /v3/) - /i/ still functions as intended.
Is there an available list of functions that one can query to verify model properties and status?