Giter Site home page Giter Site logo

Starting about forge.learning HOT 9 CLOSED

developer-autodesk avatar developer-autodesk commented on August 10, 2024
Starting

from forge.learning.

Comments (9)

augustogoncalves avatar augustogoncalves commented on August 10, 2024 1

@krosoftware this is not a monitored support channel, so may take more time... best is to use stackoverflow (autodesk-forge tag)

in this case, Windows needs " instead, so try with:

"curl.exe" -k -v "https://developer.api.autodesk.com/oss/v2/buckets" -X POST -H "Content-Type: application/json" -H "Authorization: Bearer abcd1234" -d "{\"bucketKey\":\"apptestbucket\", \"policyKey\":\"transient\"}"

from forge.learning.

jaimerosales avatar jaimerosales commented on August 10, 2024

Hello,

You are doing everything correctly, the problem is your bucket name. I'm almost 99% sure someone else already used that name. Bucket names are universal and they must be unique in order to work try something more unique for your bucket, you can generate a random guid and concatenate it with your bucket name. "test "or in this case "apptestbucket" are not very unique.

Good luck!
Cheers,

from forge.learning.

augustogoncalves avatar augustogoncalves commented on August 10, 2024

@krosoftware, additionally on what @jaimerosales mentioned, please make sure to use bucket:create scope, the CURL you posted is using code:all

see POST Buckets documentation at https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-POST/

from forge.learning.

krosoftware avatar krosoftware commented on August 10, 2024

Hello
thank you for your help.
I changed bucket name and used is bucket:create instead of code:all.
Now my commandline looks like this:
curl -k -v "https://developer.api.autodesk.com/oss/v2/buckets" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6Imp3dF9zeW1tZXRyaWNfa2V5In0.eyJjbGllbnRfaWQiOiJ1OXc4b2NYc3Y3dm96Rm9PQWVjakhGckZwRmN6cmZBbiIsImV4cCI6MTUzNTc5NTgwNywic2NvcGUiOlsiYnVja2V0OmNyZWF0ZSJdLCJhdWQiOiJodHRwczovL2F1dG9kZXNrLmNvbS9hdWQvand0ZXhwNjAiLCJqdGkiOiJZQmtnWUVidGlOekttZXhueXRYNXpLVTF6MFNrd2lMcXlIR3lNRWl5SlZUTUV5Q2NrYXBmRk1Lek1GVVF6OU43In0.rLY1hAQxtzmEoM2OlYNuwbLkTaPceBEU0-ssEs068-0" --data "bucketKey=gala_apptestbucket&policyKey=transient" --header "Content-Type: application/json"

and here is complete command and response:

curl.exe -k -v "https://developer.api.autodesk.com/oss/v2/buckets" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6Imp3dF9zeW1tZXRyaWNfa2V5In0.eyJjbGllbnRfaWQiOiJ1OXc4b2NYc3Y3dm96Rm9PQWVjakhGckZwRmN6cmZBbiIsImV4cCI6MTUzNTc5NTgwNywic2NvcGUiOlsiYnVja2V0OmNyZWF0ZSJdLCJhdWQiOiJodHRwczovL2F1dG9kZXNrLmNvbS9hdWQvand0ZXhwNjAiLCJqdGkiOiJZQmtnWUVidGlOekttZXhueXRYNXpLVTF6MFNrd2lMcXlIR3lNRWl5SlZUTUV5Q2NrYXBmRk1Lek1GVVF6OU43In0.rLY1hAQxtzmEoM2OlYNuwbLkTaPceBEU0-ssEs068-0" --data "bucketKey=gala_apptestbucket&policyKey=transient" --header "Content-Type: application/json"

  • Trying 52.215.131.27...
  • TCP_NODELAY set
  • Connected to developer.api.autodesk.com (52.215.131.27) port 443 (#0)
  • ALPN, offering h2
  • ALPN, offering http/1.1
  • TLSv1.2 (OUT), TLS handshake, Client hello (1):
  • TLSv1.2 (IN), TLS handshake, Server hello (2):
  • TLSv1.2 (IN), TLS handshake, Certificate (11):
  • TLSv1.2 (IN), TLS handshake, Server key exchange (12):
  • TLSv1.2 (IN), TLS handshake, Server finished (14):
  • TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
  • TLSv1.2 (OUT), TLS change cipher, Client hello (1):
  • TLSv1.2 (OUT), TLS handshake, Finished (20):
  • TLSv1.2 (IN), TLS handshake, Finished (20):
  • SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
  • ALPN, server did not agree to a protocol
  • Server certificate:
  • subject: businessCategory=Private Organization; jurisdictionC=US; jurisdictionST=Delaware; serialNumber=2401504; C=US; ST=California; L=San Rafael; O=Autodesk, Inc.; OU=IPG - Core Services; CN=developer.api.autodesk.com
  • start date: Mar 9 00:00:00 2018 GMT
  • expire date: Apr 20 12:00:00 2019 GMT
  • issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 Extended Validation Server CA
  • SSL certificate verify result: self signed certificate in certificate chain (19), continuing anyway.

POST /oss/v2/buckets HTTP/1.1
Host: developer.api.autodesk.com
User-Agent: curl/7.61.0
Accept: /
Authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6Imp3dF9zeW1tZXRyaWNfa2V5In0.eyJjbGllbnRfaWQiOiJ1OXc4b2NYc3Y3dm96Rm9PQWVjakhGckZwRmN6cmZBbiIsImV4cCI6MTUzNTc5NTgwNywic2NvcGUiOlsiYnVja2V0OmNyZWF0ZSJdLCJhdWQiOiJodHRwczovL2F1dG9kZXNrLmNvbS9hdWQvand0ZXhwNjAiLCJqdGkiOiJZQmtnWUVidGlOekttZXhueXRYNXpLVTF6MFNrd2lMcXlIR3lNRWl5SlZUTUV5Q2NrYXBmRk1Lek1GVVF6OU43In0.rLY1hAQxtzmEoM2OlYNuwbLkTaPceBEU0-ssEs068-0
Content-Type: application/json
Content-Length: 48

  • upload completely sent off: 48 out of 48 bytes
    < HTTP/1.1 400 Bad Request
    < Access-Control-Allow-Credentials: true
    < Access-Control-Allow-Headers: Authorization, Accept-Encoding, Range, Content-Type
    < Access-Control-Allow-Methods: GET
    < Access-Control-Allow-Origin: *
    < Content-Type: application/json; charset=utf-8
    < Date: Sat, 01 Sep 2018 09:11:29 GMT
    < Strict-Transport-Security: max-age=31536000; includeSubDomains
    < Content-Length: 33
    < Connection: keep-alive
    <
    {"reason":"Unable to parse JSON"}* Connection #0 to host developer.api.autodesk.com left intact

what can be wrong?
Thank you for your help.

from forge.learning.

jaimerosales avatar jaimerosales commented on August 10, 2024

Hey,

I see you are trying to do the whole cURL workflow to upload, translate a file. I created a tutorial a while back which should help you with this.

https://forge.autodesk.com/blog/tutorial-using-curl-2-legged-authentication-model-translation

Cheers!

from forge.learning.

augustogoncalves avatar augustogoncalves commented on August 10, 2024

Adding to what @jaimerosales said, the body should be in JSON format, so something like:

{'bucketKey':'gala_apptestbucket', 'policyKey': 'transient'}

from forge.learning.

krosoftware avatar krosoftware commented on August 10, 2024

Thank you both but it does not work for me :(
I'm currently on step 2 (creating bucket) and here is content my Windows "create_bucket.bat" file:

curl -k -v "https://developer.api.autodesk.com/oss/v2/buckets" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6Imp3dF9zeW1tZXRyaWNfa2V5In0.eyJjbGllbnRfaWQiOiJ1OXc4b2NYc3Y3dm96Rm9PQWVjakhGckZwRmN6cmZBbiIsImV4cCI6MTUzNjA0OTQ5Nywic2NvcGUiOlsiZGF0YTpyZWFkIiwiZGF0YTp3cml0ZSIsImJ1Y2tldDpjcmVhdGUiLCJidWNrZXQ6cmVhZCIsImRhdGE6Y3JlYXRlIiwiYWNjb3VudDpyZWFkIiwiYWNjb3VudDp3cml0ZSJdLCJhdWQiOiJodHRwczovL2F1dG9kZXNrLmNvbS9hdWQvand0ZXhwNjAiLCJqdGkiOiIyS2MxZGM4YTVqTkdBVWgwQXBWS0hKdTVxZmNWZmlHT2szcm1vVlBWeTdPT1BhVVRwa2lIREJBcGRsa20zZDU1In0.FJ7Xs0EiOW7aLjXmB1CR6A99syzsuOZXjrFKw5jSk4E" --data '{"bucketKey":"forge-blog-post123abc", "policyKey":"transient"}' --header "Content-Type: application/json"

and here is error code:

{"reason":"Unable to parse JSON"}* Connection #0 to host developer.api.autodesk.com left intact
curl: (3) [globbing] unmatched close brace/bracket in column 20

@jaimerosales , as I can see in your step 2, you are using very short string after "Bearer" and my string is very large.. why is that?

Can anybody try to use Windows version of curl to test my examples, please?

Here is content of my auth.bat file:

curl https://developer.api.autodesk.com/authentication/v1/authenticate --data "client_id=myID&client_secret=mySECRET&grant_type=client_credentials&scope=data:read data:write bucket:create bucket:read data:create account:read account:write" --header "Content-Type:application/x-www-form-urlencoded" -k

after I received access_token, I put them into "create_bucket.bat" file (see above) and after I execute create_bucket.bat, I'm receiving error.

@jaimerosales , I just want to follow your steps but using WIndows curl version so I want to create 6 BAT files and now I can not pass step 2 so please if someone see this and use Windows, please tell me what I'm doing wrong.
Thank you.

from forge.learning.

krosoftware avatar krosoftware commented on August 10, 2024

Can anybody help, please?
Or, is there complete working example which uploads file and preview it in viewer?
Thank you.

from forge.learning.

krosoftware avatar krosoftware commented on August 10, 2024

Awesome, thank you so much for your help, creating bucket works, now I'm going to next steps.

from forge.learning.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.