I have a pro licence for ShapeDiver and I developped and excel spreadsheet to run the External API of one of our configurator.
How can I get output data from the API?
I used this doc https://documenter.getpostman.com/view/2947303/SVzua1WT#9f60858e-66bb-4085-9ce6-df4b1d8b09d7
I manage to get Outputs in JS in the website, but not when using the API directly.
Can you help me?
You can use the
api.scene.getData() call to get data from your models, see more details on this documentation page and the API reference. Also learn more about using our API with spreadsheets in following blog post, see section Batch Processing:
Thanks for your answer.
I already read your links.
In the website it’s OK to get data with api.scene.getData().
But here I’m in Excel. So I don’t have api object.
Let say I’m in Postman. How to get outputs?
I use the “Session init and export request” API
in order to access output data of your models using the Session init and export request of our backend API, please first configure an export in your Grasshopper model. You can use the ShapeDiverExportDownload component for that purpose, and somehow convert your data to text before feeding it into the component. Use
txt as your file type. You can test your export using the export button that will show up in the viewer.
Once that works, use
api.exports.get() of the viewer’s API to find the id of your export. Use this id when making the Session init and export request. Please also include the
max_wait_time and set it to 10000 milliseconds (assuming that you have a PRO account). The reply to this request will contain a download link to the exported text file.
When running the Session init and export request from your local Postman app, you will be able to find some scripts explaining on how to locate the download link in the API response:
Ok it’s more complicated than I expected.
I Hope I could get output values directly via the API
But I’m going to test it!
Towards the end of Q1 we plan to launch an SDK for our backend API as npm package, which will simplify the use the API and also allow you to access data outputs without using exports.
So do I understand correctly that there is currently no way to access the data outputs that you can get with api.scene.getData() in the viewer using the backend API unless you would export it as a file? I guess exporting as a .json file would make more sense, but would still be way more complicated than just getting an actual json response.