Hi Jeff, Thanks for you thoughts. I find it a bit awkward to reply within the google docs document. So here we go:
For a true REST API, URLs are always nouns and never verbs. (HTTP provides the verbs, such as GET and POST.) I agree, not sure how you got there. So you'd have (for instance) "https://127.0.0.1/plugins/kicad/categories <https://www.google.com/url?q=https://127.0.0.1/plugins/kicad/categories&sa=D&source=docs&ust=1687734166579104&usg=AOvVaw1O7URElFplJxQbJ5LwNumP>", which would return a list of categories. That sounds reasonable and I am happy to use plurals instead. You could then query "https://127.0.0.1/plugins/kicad/passive%20parts/parts <https://www.google.com/url?q=https://127.0.0.1/plugins/kicad/passive%2520parts/parts&sa=D&source=docs&ust=1687734166579285&usg=AOvVaw0FoP-UCaCccbt5ZHJjPyBO>" to get a list of parts, and " https://127.0.0.1/plugins/kicad/passive%20parts/R_0R0_0603/description <https://www.google.com/url?q=https://127.0.0.1/plugins/kicad/passive%2520parts/R_0R0_0603/description&sa=D&source=docs&ust=1687734166579339&usg=AOvVaw1_QPbG3IzCjh2rGfzoa-Rb>" to get the description of that part ("SMD Zero ohm Jumper"). I am not a big fan of "passive%20parts <https://www.google.com/url?q=https://127.0.0.1/plugins/kicad/passive%2520parts/parts&sa=D&source=docs&ust=1687734166579285&usg=AOvVaw0FoP-UCaCccbt5ZHJjPyBO>" as this makes things a bit ambiguous. A primary key is only used once which means it is easy to identify. So if you'd want to access all parts of the category "Active Parts" you could go to https://127.0.0.1/plugins/kicad/parts/?category_id=12 or whatever we decide to call it. This will make sure that you get exactly what's expected. Reason, there could be Active Parts multiple times; it really depends on the users data structure which I believe we shouldn't try to control. We wouldn't have to follow it all the way down (" https://127.0.0.1/plugins/kicad/passive%20parts/R_0R0_0603 <https://www.google.com/url?q=https://127.0.0.1/plugins/kicad/passive%2520parts/R_0R0_0603&sa=D&source=docs&ust=1687734166579386&usg=AOvVaw3kWG7UbEq61Y_WM2APpWlR>" could just return the JSON including all the fields). I believe there should be a 'light' version of it to get a preview which would speed things up when loading and a 'full detail' version which contains everything about the part. I don't think we want a hard-coded REST root URL (because that limits you to a single plugin). I'd rather see that configured in Preferences (similar to your Text Editor or PDF Viewer). The root URL would not be hard coded. The user would specify it like they do with the database plugin. But rather than using a 'dsn' one would use a 'url'. Only the endpoints are fixed. This makes things simple and less can be screwed up because every little detail is configurable. One would only need the following parameters: - url - username - password - type (if we would want to re-use existing code) - timeout (maybe, not sure yet) (Note: I am aware that some 95% of "REST" APIs aren't acutally REST APIs. But that's not a reason for us to go down that path.) I would like to follow it as much as possible. Cheers On Sunday, 25 June 2023 at 12:30:36 pm UTC+10 Andre Iwers wrote: > Please find below my proposal for a REST API interface. > > > https://docs.google.com/document/d/1qXKEa9Djz1VnEzH7jK0rJ1p9Vu82tq4p_m2zBuNMG6k/edit#heading=h.fyuo1bpfgubj > > Cheers > -- You received this message because you are subscribed to the Google Groups "KiCad Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to devlist+unsubscr...@kicad.org. To view this discussion on the web visit https://groups.google.com/a/kicad.org/d/msgid/devlist/7515d142-80ab-4b91-9bc1-6048777c9286n%40kicad.org.