0

我正在尝试使用此 curl 调用将文件填充到照片场景中,但未成功:

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 

标准输出 =

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

API 示例和现场指南让我看不到哪里出了问题。

标准误差 =

    * 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

我最初用多个文件尝试过这个,无论我做一个文件还是多个文件,都会遇到同样的错误。

4

1 回答 1

0

我认为您的 curl 调用是“格式错误的”:

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

根据将文件添加到 photoscene 的文档,它接受作为参数photosceneid类型(调查或图像)和file[]

通过提供gpstypescenetype和 wrong type,您会得到上述错误。

您的电话应如下所示:

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

和以前一样,我强烈建议将 Postman 与此系列一起使用,以避免落入此类陷阱。

于 2018-08-02T16:18:58.017 回答