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.

Communicating a Google Sheet with the Onshape API

fer_fer_fer_fer_ Member Posts: 6 ✭✭

Hello, I'm trying to "Communicate a Google Sheet with the Onshape API" to retrieve images by obtaining a URL or to save a PDF to Google Drive.

/*
Export a document to another format:
POST
/documents/d/{did}/{wv}/{wvid}/e/{eid}/export
*/
function downloadBlobElement(did, wv, wvid, eid) {
    const url = `/documents/d/{did}/${wv}/${wvid}/e/${eid}/export`;
    // Here you can perform the logic to download the blob using the URL
}

For this purpose, I am using Google Apps Script (JavaScript), which is a utility that comes by default in Google accounts. Apps Script is used to create automations / custom tools in documents such as: 

https://www.google.com/script/start/

I have several questions that I will number:

1) Authentication is not clear to me. With a URL from a "Part Studio," every time I switch between "Part Studios," do I have to change authentication? (I'm not referring to the Access Key Secret Key) Does the token change?

I already have:

  • The Access key
  • The Secret key
  • The Scopes
2) Is there any limitation on the part of Onshape when receiving API requests from a Google server?

3) My Onshape account is not Enterprise. Could I download PDFs or images?

4) I don't quite understand the role of the API Explorer. Beyond seeing how they return the Json message. Could you exactly list the utility it plays in API programming and the workflow?
Tagged:

Comments

  • Caden_ArmstrongCaden_Armstrong Member Posts: 194 PRO
    1. If you are using OAuth, the access token is valid for a period of time (~1 hour). After which it expires and you use the refresh token to get a new access token. Its not locked to a specific document or anything.

    2. The source doesn't change any limitations, but there is always an API request limit of something like 1,000 requests per minute.

    3. The API always has the same permissions as the user account that it is authenticated with. Most things you can do, so can the API.

    4. Its a development tool, it lets you test an API request before having to add it to your program. Its more useful when you are working on big applications or complicated processes, fills the same role as like postman but in a more specialized way. Not a requirement, but a helpful start.
    www.smartbenchsoftware.com --- fs.place --- Renaissance
    Custom FeatureScript and Onshape Integrated Applications
Sign In or Register to comment.