Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Somehow get access to the url representing the thumbnail of a released item

shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
edited September 2021 in General
I hoping there is a way to do this.  I hoping the thumbnail of a released item can be displayed in another cloud system automatically without have to manually create an image file.  Is it possible to get the thumbnail url?

Best Answers

  • chadstoltzfuschadstoltzfus Member, Developers, csevp Posts: 142 PRO
    Answer ✓
    I'm not super familiar with Appsheet but taking a glance at it I'm guessing the only way to link the two is creating or finding an application that uses Appsheet's API and Onshape's API and joins the two together. It looks like you can use Appsheet API calls to populate records, so the workflow would look like this:

    Open the application
    Click on an update button
    Use Appsheet API to pull all of the records
    Implement some way to match up Appsheet with Onshape documents (probably a document URL in a record)
    Use Onshape's API to get the thumbnails from the URLs and insert the thumbnails into the Appsheet records.

    Not really a great solution, ideally you would want something that automates this process so you don't have to click an update button. I'm unsure if Appsheet has this capability. 
    Applications Developer at Premier Custom Built
    chadstoltzfus@premiercb.com
  • bill_schnoebelenbill_schnoebelen OS Professional, Developers, User Group Leader, csevp Posts: 120 PRO
    Answer ✓
    To get the cid you need to run Elements:Get Configuration and find this guy in the json. Then the above works.





Answers

  • shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
    @lougallo
    Do you know if this is possible?  I'm sort of assuming no but this system has made a habit out of surprising me with what is possible.
  • chadstoltzfuschadstoltzfus Member, Developers, csevp Posts: 142 PRO
    I'm not sure if the thumbnail URL can be acquired through traditional means, but you are able to access the thumbnail of a document using some API (using the thumbnails endpoint), parsing the JSON response, and displaying via HTML using
    <img src="data:image/png;base64(MIME base64 encoded data)/>


    Applications Developer at Premier Custom Built
    chadstoltzfus@premiercb.com
  • shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
    I'm not sure if the thumbnail URL can be acquired through traditional means, but you are able to access the thumbnail of a document using some API (using the thumbnails endpoint), parsing the JSON response, and displaying via HTML using
    <img src="data:image/png;base64(MIME base64 encoded data)/>


    Thanks.  I am extremely unfamiliar with API any thingness.  I am creating something using appsheet and I am hoping to somehow have onshape thumbnails populating appsheet inventory items.  Do you by any chance know if digging into the API could even provide such an ability.  I'm just checking to see the validity of my goal before diving in.
  • chadstoltzfuschadstoltzfus Member, Developers, csevp Posts: 142 PRO
    Answer ✓
    I'm not super familiar with Appsheet but taking a glance at it I'm guessing the only way to link the two is creating or finding an application that uses Appsheet's API and Onshape's API and joins the two together. It looks like you can use Appsheet API calls to populate records, so the workflow would look like this:

    Open the application
    Click on an update button
    Use Appsheet API to pull all of the records
    Implement some way to match up Appsheet with Onshape documents (probably a document URL in a record)
    Use Onshape's API to get the thumbnails from the URLs and insert the thumbnails into the Appsheet records.

    Not really a great solution, ideally you would want something that automates this process so you don't have to click an update button. I'm unsure if Appsheet has this capability. 
    Applications Developer at Premier Custom Built
    chadstoltzfus@premiercb.com
  • shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
    @chadstoltzfus Thanks.  I will start testing the onshape api waters.
  • bill_schnoebelenbill_schnoebelen OS Professional, Developers, User Group Leader, csevp Posts: 120 PRO
    Did you get this working? 

    I just need somethng which kicks out the thumbnails for use in a google sheets qoute. Pictures make life so much easier.

    I tried:

    • featurescript: won't get a thumbnail
    • API:Thumbnails: take a long time to update and not good for muliple parts
    • API:Part:Shaded Veiw: This works nice, but I don't know the id of part
    • API:Part:Get Parts In Part Studio with/thumbnails seems to be the most promising


  • shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
    @bill_schnoebelen
    I have not got this working.  I haven't had time to get into the "learning API headspace" just yet.  It would be really awesome to be able to generate a link similar to a barcode generator that just spits back an image.  What I am noticing though, is the thumbnail in Onshape, when doing a search for a configured part number, does not always represent the configuration of the part number that was searched.  This might through a wrench in what I wish to accomplish.
  • bill_schnoebelenbill_schnoebelen OS Professional, Developers, User Group Leader, csevp Posts: 120 PRO
    This may work (under thumbnails), but you need to figure out how to get the cid.




  • bill_schnoebelenbill_schnoebelen OS Professional, Developers, User Group Leader, csevp Posts: 120 PRO
    Answer ✓
    To get the cid you need to run Elements:Get Configuration and find this guy in the json. Then the above works.





  • shawn_crockershawn_crocker Member, OS Professional Posts: 865 PRO
    @bill_schnoebelen
    Thanks!  I will looking into making use of this info.
  • bill_schnoebelenbill_schnoebelen OS Professional, Developers, User Group Leader, csevp Posts: 120 PRO
    Here is a down a dirty way to get the thumbnails for Part Studios and Assemblies.

    Although they should, configurations don't work on the parts. I could not find a documented way to do configurations on assemblies. The actaul thumbnails may work here. I am using shaded views.

    I am not sure if this is proper with the API Keys. There is not a good way to hide it. So be careful! I am the only one using my spreadsheet.

    The API works in google script because I used generic-endpoints. Onshape is the server. I am not sure if this is meant for a production enviroment. But it works for now!

    https://docs.google.com/spreadsheets/d/1pAPrkvImQmAe-Eb6m1cQWw4pFx-2CABSnJ-Bbiqps2U/edit#gid=0
Sign In or Register to comment.