-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API #1333
Comments
This could be awesome, thanks! Unfortunately, although it's in our roadmap, having an API to interact with penpot files has not any scheduled date yet. I don't know if there could be some shortcut for this. What data would you exactly need to do the connection? |
Hello! This is an area of interest for us as well. Main priorities for us would be,
We can introspect SVG on our side, introspection APIs are not priority IMO. Would be nice to have (but not priority) APIs would be,
|
Hi, sorry for the late reply. I would need some "get File" endpoint where:
Cheers, Klaus |
Thanks for the feedback, it is very interesting. Having API that returns SVG it a bit complicated right now, because all the svg is generated on the browser side; but returning a json with all the components structure (practically the same as the penpot frontend consumes it) it is pretty easy task. Also, returning all the "links" and all images is also possible (probably direct links). |
Hi, JSON would be most likely easier for me. I assume curves and paths are somehow encoded in the JSON as SVG d strings?
The JSON would be something like
|
Oh! Interesting. I think "json with all the components structure" is better than SVG anyway, for purposes like extracting info from designs. SVG wouldn't be a priority I think, only good to have in long term, for external archival purposes, etc. |
The pasted image shows the verbose (and prettyprinted) data encoded using transit (https://github.com/cognitect/transit-js) |
Jumping in her and linking to a semi related issue I've just created - I am able to update images using the API (I've integrated with "api/rpc/command/upload-file-media-object" and "api/rpc/command/update-file" to make this work, but text is a whole other kettle of fish. The challenge I've been running into (outlined in the issue) is that I don't know how to reasonably calculate the position data. Introspecting the code and trying to reverse engineer the approach the app takes, it appears it uses the DOM to calculate this on the frontend and then sends this data too the backend. I'm successful in updating the content of a textbox via the API, but in order for that to "work" i need to either a) have that page open in my browser when i execute the API to update the content (this results in my browser being triggered to make the subsequent calls to trigger the position data updates) OR i need to send position data (this is my preference, if i can figure out how to accurately calculate it) in order to see these updates take effect without needing to have the page open while the content update occurs via API. My end goal here is to automate the creation of fairly standard design files and update them via API so i can pump them out automatically. I feel like editing text/images is fairly simple in terms of a requirement, and im 90% of the way there, but as always the final 10% is very trick in this instance as calculating the position data (especially for custom fonts feels impossible via the backend) |
Is your feature request related to a problem? Please describe.
I would like to download design through an API, very much like Figma. This would allow me support Penpot with https://github.com/KlausSchaefers/vue-low-code
Describe the solution you'd like
I need an API that allows do download the design (and images)
Describe alternatives you've considered
none
Additional context
The text was updated successfully, but these errors were encountered: