Developer-Autodesk / forge.learning

Autodesk Forge Tutorials: Learn the basics of authentication, data management, file translation, and model rendering, with our quickstart guides.
http://learnforge.autodesk.io
MIT License
23 stars 18 forks source link

Start - simple page #15

Closed krosoftware closed 6 years ago

krosoftware commented 6 years ago

Hello I try to use forge API's using simple web-page (no npm/nodeJS, PHP of C#...). With other words, is there some simple example which does not use NodeJS but simple HTML/JavaScript and where page run on webserver? Also, is there some example showing how to login to my account and to upload some file, convert it and view on Viewer, please? Thank you.

augustogoncalves commented 6 years ago

To use any Forge API you need Authentication, which must be done server-side in order to protect your key & secret. The learnforge.autodesk.io tutorial includes the UI (HTML/JS) and the required server-side code to: authenticate, upload, translate and list files.

For testing purposes, you can do Authentication using a command line or Postman (or other tools), but the token will expire after 30 minutes and you have to authenticate again.

Now if you just want to show a model on your website, without any programming, you can simply upload it to BIM 360 Team and share using the embedded HTML code provided (after click on Share).

image

krosoftware commented 6 years ago

Thank you for your time to answer. I checked http://learnforge.autodesk.io/#/?id=learn-autodesk-forge but can not find HTML/JS example - can you please share direct link? Thank you.

augustogoncalves commented 6 years ago

It's a tutorial, so you should go through the steps.... the HTML/JS code is here: http://learnforge.autodesk.io/#/viewer/2legged/ui (but this still needs server-side code)

krosoftware commented 6 years ago

Awesome, thank you so much. I didn't saw it. How about server code? I'm come from Windows programming (desktop) and web is new to me. If you have some additional instructions of how to start, I will be grateful. I searched a lot for some simple example (complete) where I can put my credentials and to access my https://myhub.autodesk360.com where my files are stored. Best option will be to have connect, upload local file, convert it and view it to browser. I just can not find some complete example or I do not understand how whole thing works. I will study how to use sample you provided, thank you again.

augustogoncalves commented 6 years ago

This tutorial should be what you need to get started, but you need to run it from the beginning, including Tools section.

The View your Models section should include all steps you need to authenticate, upload, translate and show.

As you mentioned desktop... are you using .NET? Make sure to select this language during the tutorial.

krosoftware commented 6 years ago

Thank you for additional links, I will check them. I'm not using .NET but Clarion for Windows and that's the reason why I search for HTML/JS (not NodeJS or .NET or PHP). With other words, I try to use HTML/JS and what I need is "all in one" example/tutorial of how to authenticate, upload and view file in browser viewer. I see there are examples for NodeJS, PHP, .NET etc. but I'm not familiar with them. My idea is to upload files to my web-server and to allow my clients to upload/convert/view files. I can use (for example) PHP for authentication but for other work I prefer HTML/JS - I looked at NodeJS but not able to use examples and I'm not sure how to upload and use them on web-server?

augustogoncalves commented 6 years ago

Once you have the access_token you can create a bucket and upload via browser... it's not safe to expose the token, I must say.

krosoftware commented 6 years ago

Thank you! I will collect all steps you send me. Thanks a lot.