autodesk-forgeautodesk-realitycapture

can't populate files into photoscene - error code=4 msg=Not yet implemented


I am trying, unsuccessfully, to populate files into a photoscene with this curl call:

curl -v 'https://developer.api.autodesk.com/photo-to-3d/v1/file' -X 'POST' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6Imp3dF9zeW1tZXRyaWNfa2V5In0.eyJ1c2VyaWQiOiJZUlZNSlNFNTdFVzMiLCJleHAiOjE1MzMxNzI5MzgsInNjb3BlIjpbImRhdGE6d3JpdGUiLCJkYXRhOmNyZWF0ZSIsImRhdGE6cmVhZCJdLCJjbGllbnRfaWQiOiJIQXFEdEtPN1ZidVJnSDBuTDBNRkowQjAyRWxCRUszbCIsImdyYW50X2lkIjoiRGRWdk41TjdCODAycUxaaFE2RktzVWMzRUxCTGQydUgiLCJhdWQiOiJodHRwczovL2F1dG9kZXNrLmNvbS9hdWQvand0ZXhwNjAiLCJqdGkiOiJVNXhTVHBFQXllV1haQnM3elc1eElKMGtFRDBhMlZNbFU1OGF5MWJuV0xMeU9Fb05nNUE2SDRLdDVBNGpnSFRxIn0.UAeCITOgg-QRqgi8O9Ws3Uyk5N10eP51wIWB-CawOf0' -d 'photosceneid=sCn1zSOVLb7mPiKkgFRbkxCOTynOhP78F5EuuqbbYig' -d 'type=obj'  -d 'scenetype=object' -d 'gpstype=regular' -d 'file[0]=https://prod.sonautics.com/scans/s1-sample-ear-201802062058/snapshot-2018020621001063.jpg'  2> /tmp/s1-sample-ear-201802062058_20180801172526 

Stdout =

{"Usage":"0.80453681945801","Resource":"\/file","Error":{"code":"4","msg":"Not yet implemented"}}

The API examples and Field Guide give me no visibility into what is wrong.

StdErr =

    * Hostname was NOT found in DNS cache
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 52.10.62.203...
* Connected to developer.api.autodesk.com (52.10.62.203) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Server hello (2):
{ [data not shown]
* SSLv3, TLS handshake, CERT (11):
{ [data not shown]
* SSLv3, TLS handshake, Server key exchange (12):
{ [data not shown]
* SSLv3, TLS handshake, Server finished (14):
{ [data not shown]
* SSLv3, TLS handshake, Client key exchange (16):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Finished (20):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
{ [data not shown]
* SSLv3, TLS handshake, Finished (20):
{ [data not shown]
* SSL connection using ECDHE-RSA-AES128-GCM-SHA256
* Server certificate:
*    subject: businessCategory=Private Organization; 1.3.6.1.4.1.311.60.2.1.3=US; 1.3.6.1.4.1.311.60.2.1.2=Delaware; serialNumber=2401504; C=US; ST=California; L=San Rafael; O=Autodesk, Inc.; OU=IPG - Core Services; CN=developer.api.autodesk.com
*    start date: 2018-03-09 00:00:00 GMT
*    expire date: 2019-04-20 12:00:00 GMT
*    subjectAltName: developer.api.autodesk.com matched
*    issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 Extended Validation Server CA
*    SSL certificate verify ok.
> POST /photo-to-3d/v1/file HTTP/1.1
> User-Agent: curl/7.35.0
> Host: developer.api.autodesk.com
> Accept: */*
> Authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6Imp3dF9zeW1tZXRyaWNfa2V5In0.eyJ1c2VyaWQiOiJZUlZNSlNFNTdFVzMiLCJleHAiOjE1MzMxNzI5MzgsInNjb3BlIjpbImRhdGE6d3JpdGUiLCJkYXRhOmNyZWF0ZSIsImRhdGE6cmVhZCJdLCJjbGllbnRfaWQiOiJIQXFEdEtPN1ZidVJnSDBuTDBNRkowQjAyRWxCRUszbCIsImdyYW50X2lkIjoiRGRWdk41TjdCODAycUxaaFE2RktzVWMzRUxCTGQydUgiLCJhdWQiOiJodHRwczovL2F1dG9kZXNrLmNvbS9hdWQvand0ZXhwNjAiLCJqdGkiOiJVNXhTVHBFQXllV1haQnM3elc1eElKMGtFRDBhMlZNbFU1OGF5MWJuV0xMeU9Fb05nNUE2SDRLdDVBNGpnSFRxIn0.UAeCITOgg-QRqgi8O9Ws3Uyk5N10eP51wIWB-CawOf0
> Content-Length: 196
> Content-Type: application/x-www-form-urlencoded
> 
} [data not shown]
* upload completely sent off: 196 out of 196 bytes
100   196    0     0  100   196      0    152  0:00:01  0:00:01 --:--:--   152< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Thu, 02 Aug 2018 00:25:30 GMT
* Server Apache/2.4.6 (CentOS) is not blacklisted
< Server: Apache/2.4.6 (CentOS)
< Set-Cookie: AWSALB=dOqkcEp8OYPvUDA9SW86BUbDR9fMvps1hOy9DgDFHWr3nxHMl8qK/pnc2C6ryLHGUZ3fi8W5ZyIujQaqj/JrW47V+ehxQMsKnIHeK4wZEneIQ/L/2dqfdCY5R+pD; Expires=Thu, 09 Aug 2018 00:25:29 GMT; Path=/
< X-Powered-By: PHP/7.0.30
< Content-Length: 97
< Connection: keep-alive
< 
{ [data not shown]
100   293  100    97  100   196     63    127  0:00:01  0:00:01 --:--:--   127
* Connection #0 to host developer.api.autodesk.com left intact

I tried this initially with multiple files, and got the same error whether I do one file or many.


Solution

  • I think that your curl call is "ill-formed":

    curl  -v 'https://developer.api.autodesk.com/photo-to-3d/v1/file' \
    -X 'POST' \
    -H 'Authorization: Bearer '$TOKEN \
    -d 'photosceneid=sCn1zSOVLb7mPiKkgFRbkxCOTynOhP78F5EuuqbbYig' \
    -d 'type=obj'  \
    -d 'scenetype=object' \
    -d 'gpstype=regular' \
    -d 'file[0]='$link
    

    According to documentation for adding files to a photoscene, it accepts as params photosceneid, type(survey or image) and file[].

    By providing gpstype, scenetype and wrong type, you get the mentioned error.

    Your call should look like:

    curl  -v 'https://developer.api.autodesk.com/photo-to-3d/v1/file' \
    -X 'POST' \
    -H 'Authorization: Bearer '$TOKEN \
    -d 'photosceneid=sCn1zSOVLb7mPiKkgFRbkxCOTynOhP78F5EuuqbbYig' \
    -d 'type=image'  \
    -d 'file[0]='$link
    

    As before, I highly advice using the Postman along with this collection, to avoid falling into these kind of traps.