Re: State of Plone web api
Rok Garbas <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <20140116091114.8135.36392@oskar> |
Quoting Dylan Jay (2014-01-16 02:46:49) > On 16 Jan 2014, at 1:24 pm, David Glick (Plone) <david.glick-z4DKO/[email protected]> > wrote: > > > On 1/15/14, 6:13 PM, Dylan Jay wrote: > >> <rant> Plone's web api sucks. For example setting custom field values on > >> objects via web calls. For archetypes - you can't use the .update method > >> Zope traversal doesn't parse *kwargs type method definitions - you can use > >> setFIELDNAME accessors created AT via XMLRPC or normal url. Except that it > >> doesn't work with archetypes.schemaextender fields - you can't use XMLRPC > >> for any method that requires keyword args. So accessors that use keywords > >> args can't use XMLRPC WebDAV - doesn't support propfind propset propget > >> for any schema based fields. Only standard fields like Title and > >> creationDate - RFC822Marshaller is used for most types so you can upload > >> all the content + custom fields via a PUT request. Except this isn't used > >> for files or images so there is no way via webdav to set custom fields > >> Dexterity Can't be done for dexterity objects at all that I've worked out. > >> Maybe via RFC822Marshaller and PUT but as above, is unlikely to work for > >> File or Images. > >> > >> So if you want to set schemaextender or dexterity fields or some kind of > >> consistent api for setting... it just isn't there :( Possibly the only way > >> I can think of doing it with out-of-the-box Plone would be to upload > >> a PythonScript that does the setting for me. > >> > >> </rant> > >> > > Dexterity does its own rfc822 marshalling using plone.rfc822, and > > plone.namedfile extends that to handle files and images. > > > > Anyway, the reason Plone doesn't have a web-accessible API (I'd consider > > most of the above to be non-web APIs that happen to be semi-accessible via > > HTTP) is because no one's built a good one and seen it through the process > > of getting it added to core. What sort of API *should* we have? > > An update method on both AT and DX objects that takes a single dictionary of > field->value mappings would work for me. A generic set method that takes > fieldname and value would also be good. > > In an ideal world if plone.api is going into plone then a way to map api > calls into web requests. However I don't see anything in plone.api now to set > field values [1]. also many of the calls might be hard to convert as they use > keyword args and often args that are object references. > > [1] > http://developer.plone.org/reference_manuals/external/plone.api/api/content.html > i'm not sure what the state of the work is. but there was an idea that plone.api could be used and expose most of its calls also via json https://github.com/xiru/plone.api.json -- Rok Garbas - http://www.garbas.si ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk