-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Define API/Spec for batch uploading sketches #542
Comments
Is the API being worked on right now ? That's seems like a bit of work, so it should probably be split in several parts; I'll start looking into it anyway ^^ |
You're right, this is a huge issue! I think a good first step would be dividing this into smaller issues, figuring out all of the steps that would need to go into this. We can discuss on this issue! |
Ok, so the first thing would be to allow registered users to add API keys via their user settings, and of course store them in the database.
|
The first part is covered in #541! My starting point for figuring out what API endpoints should be is, surprisingly, a fairly old Rails guide. Therefore, I think the endpoint for uploading a new sketch should be POST Also, to list some other stuff I think needs to happen:
|
|
|
Also ! (and this is kind of unrelated to the issue, but I don't know where to talk about this) I'll be hosting a Hacktoberfest event Saturday, so I'll try to send students this way (and more generally to the processing repositories). |
i think a good reference could be @joeyklee's script to upload the ml5 examples to the web editor (https://github.com/processing/p5.js-web-editor/blob/master/server/scripts/examples-ml5.js). maybe the format of the sketches should be similar to how files are stored on github, and then once sent to the API, could be converted using the helper functions (or similar helper functions) that are in that uploader file. |
@catarak - I'm happy to help in any way on this + very much looking forward to making this happen! Thank you! |
I've started thinking about the shape of the API that supports sketch uploads. #541 covers the authenticaton work to allow access to the API so the comments below assume it exists. We already have a rich API that has sketch CRUD functionality, so the existing import scripts could be rewritten to use the existing API at The existing endpoints could also be extended to allow files to be created in a more friendly way. Specifically, IDs would be generated on the server instead of in the scripts (see #1073 for a proposal). This still means more code, but the ultimate aim could be updating the Editor client web app to use the new API fields. The downside to this approach is that some of these endpoints would now become a public API and we'd need to be careful making changes to them. As part of this work, I'd like to write tests around whatever code is touched, so this would be a good way of making sure we don't break things going forward. And we'd document the endpoints that are now public. Alternatively, we can create new endpoints that are the public API. This would reduce the implementation complexity, but would mean more code that would be doing very similar things. Would be great to hear your thoughts @catarak. |
As we talked about, I think the best way to move forward with this is to
Then, we can write tests that will test both the public API and the API for the web editor! |
You could maybe consider an api similar to codesandbox.io (https://codesandbox.io/docs/api). Easy way to generate a new sketch on the fly without having to pre-generate all examples in a script. |
Nature of issue?
New feature details:
Define endpoints so that users can batch upload sketches. This also includes the data structure of the sketches themselves. It's a little complicated right now given recursive file structures of folders and this involves generating ID's for file objects. It would be cool if users didn't have to do that and it happened magically on the backend.
The text was updated successfully, but these errors were encountered: