RE: Enquiry

Hi Matthew,

On Tuesday, October 21, 2014 1:16 PM, Matthew Slater wrote:
> Thanks Markus
> 
> Decoupled CMS was interesting, but I didn't see how I could actually
> apply it. It seems to propose an approach, not to offer me tools.

Have you looked at

  http://decoupledcms.org/links.html


> I could probably expose content with views and some xml/json but all
> CRUD operations are needed.

Right


> Drupal's services module exposes entities and fields with Drupal's own
> structure which is wierd for 3rdparty app developers. e.g.
> 
> $entity->field_name[language_code][delta] = array(value => whatever,
> $format => whatever)
> 
> where the keys of the array are specific to the field type. I think
> this is the same in Drupal 8 because drupal has no notion of a
> 'flattened' entity or standard way of representing data in different
> fields before rendering.
> 
> So I want to output flat arrays assuming the language is given and the
> field has a cardinality of 1.

Wouldn't it be quite straightforward to write a serializer that does that?


> Your response didn't mention Hydra as a possible solution at all.

The first step is to serialize the data as JSON-LD. Hydra can then be used to describe the operations that the various resources support.


> I'm ready to write my own REST interface - its not that hard but I'm
> still hoping for some tools or at least standards I can work to. I
> wouldn't implement what I've seen of Hydra because it was too complex
> for me to understand. However if tools already exist, that wouldn't
> matter.

I'm still trying to understand what exactly you need/want to build. Hydra is just a vocabulary which allows you to describe your service interface in a machine-readable manner. Nothing more, nothing less. The first step is to get the data out, as soon as you've accomplished that, we can describe to a client how to interact with it. I'm more than happy to help with this, so feel free to post questions and share your progress on the mailing list. Unfortunately, I currently don't have the time to directly help with the implementation... but I'm happy to review it if you want me to.


--
Markus Lanthaler
@markuslanthaler



 
> Matthew
> 
> On 21 October 2014 11:08, Markus Lanthaler <markus.lanthaler@gmx.net> wrote:
> Hi Matthew,
> 
> And welcome to the list.
> 
> 
> On Friday, October 17, 2014 11:45 PM, Matthew Slater wrote:
> > I expect its not too difficult to build a db and expose lots of content
> > types and fields with some kind of security wrapper. But at the moment
> > all the data is defined and managed in Drupal.
> > The Drupal Services module exposes content using Drupal's complex
> > internal data structures which are not intuitive to external
> > applications.
> > So we need to define and publish and implement a rest API just for this
> > data set. I was wondering if there was an easier way.
> 
I'm not too familiar with the current state of Drupal but wouldn't it be possible to create a "View" and add a "REST export"? Alternatively, implementing a > specialized serializer might work as well I guess.
> 
> 
> > What I would ideally like is a standard way for 3rd party application
> > to query my data structure, to find out what content types and fields
> > are available, and from that information to generate its own content
> > displays, its own content editing form, so that the data held on a
> > central server can be managed by many apps, not just Drupal.
> 
> This goes a bit in the direction of decoupledcms.org Maybe you can leverage some of their work!?
> 
> 
> > I don't want to have to change the code every time somebody changes the
> > data structure.
> > Seems such a generic requirement. Is it possible the code exists to
> > this, server-side and even app side?
> 
Btw. are you talking about the upcoming Drupal 8 or an older version? I think Drupal 8 provides much more than older versions in this regard and it is also > much simpler to extend/tweak it as you need. Have a look at the Web Services and Context Core Initiative (WSCCI) [1] to get started.
> 
> 
> HTH,
> Markus
> 
> 
> [1] https://groups.drupal.org/wscci
> 
> 
> --
> Markus Lanthaler
> @markuslanthaler
> 
> 
> 
> -- 
> Find out more about my work in local money systems
> Twitter: @matslats
> My personal web site including my blog, Adventures in mutual credit
> Lecture about cryptocurrencies (18 min)
> Brief bio and articles on shareable.net
> I co-founded Community Forge
> Bitcoin donations accepted: 1QLPWcQpp1x2Qzqocjm2CfnpoiCLUd4JXt

Received on Monday, 27 October 2014 14:09:16 UTC