I think it's a problem that Services tries to include resources for all functionality in Drupal core. It's a major task to provide an API for Drupal and its something that can be solved in lots of ways. Services can be used to build all kinds of API:s for Drupal - but I don't think Services should try to solve the problem itself - it would be a huge distraction from the core objective of building an amazing framework for API:s.
Services should promote the creation of new modules that exposes Drupal through API:s. Modules like OAuth Login Provider, Services Views and perhaps in the future Blog API. The creation of more such modules would give us a lot more valuable feedback and ensure that Services gets as powerful and flexible as it should be and would be a good showcase of that.
Comments
Comment #1
gddTrying to clear out the 7.3 issue queue, will move these to 7.4 when it opens
Comment #2
ygerasimov commentedVery big +1 on this issue.
We have even some resources helpers in services.module file (services_resource_build_index_query(), services_resource_build_index_list()) that really shouldn't be there.
I would move core resources just to separate submodule of services. I think Services should provide good examples of usage of its API.
Comment #3
jamielennox commentedI semi-agree.
I think the problem though is not that services tries to provide all the functionality of drupal core, but that it seeks to do them individually.
With everything an entity, and fields on an entity, is it not possible to just abstract away most resources?
So an example scenario:
1. Admin creates services as now and selects the node entity type to have CRUD access functions enabled.
2. Admin edits the Retrieve function to say and selects the fields that they want to be returned and the alias that it should be returned as. Eg. fied_id => ID, field_name => 'User Name', field_dob => 'dob'.
3. User calls the service to retrieve the user id: 4 returning
{
'ID' : 4,
'User Name' : 'John Smith',
'dob' : '1/1/1970'
}
Given that we know about entity types and their fields - is this possible?
In the event that this information is not sufficient we can then call the x_resource module for more data.
Note that i've only been playing with services for a couple of days, so don't know the intricacies.
Comment #4
marcingy commentedBy removing it would mean that core services would only provide a framework and no resources at all, so it wouldn't result in the addition of entity based system instead. I'm not keen on creating submodules to be honest because it makes things all the more cluttered. The downside of remove resources from services core is that we will lose examples however that could be overcome by providing a single example_service.module.
Comment #5
jamielennox commentedupon re-read i see that my comment was indeed not really relevant to this but i will post is as a seperate issue.
Issue: #1242338: Simple Entity Based Resources
Comment #6
voxpelli commentedI'm +1 on marcingy here - a submodule to the Services module wouldn't solve anything - they need to go away from the core project and be replaced by example resources instead. That would be the right focus for Services core - creating good examples that promote good practices.
The goal of the current core resources isn't to show the best way to do things but just for them to replicate Drupal core as much as possible - which I don't see as beneficial to Services core at all.
Comment #7
seandunaway commentedBut it didn't workout well for Views support.
The quantity of maintainers/contributors and number of installs help ensure the resources are maintained.
Comment #8
g10 commented+1 for separate module
Being able to disable certain resources at module level would be an added benefit:
eg. when a custom 'user' resource implementation is needed, there is no option to overwrite the default one (besides adding 'return array()' at the top of the _user_resource_definition(), which is not very clean and not handy when upgrading the services module)
Comment #9
kylebrowning commentedRe: #8 that sun true, use drupal_alter('services_resources', $resources, $endpoint);
Comment #10
g10 commented@kyle, tnx for the tip! was not aware of that hook
this does the trick indeed:
Comment #11
kylebrowning commentedWont fix in 3.x but ive added it as a list of things to do for 4.x
Comment #12
fuzzy76 commentedIf it's not actually done yet, I guess it's not fixed. :)
Comment #13
marcingy commentedThis was closed on purpose by a maintainer
Comment #14
fuzzy76 commentedIt was said that the issue was going to be fixed, and it is not fixed yet. Thus, the issue is actually ongoing, and closing it makes no sense.
Comment #15
kylebrowning commentedWe meant to close it as won't fix so as marcingy said, it has the appropriate status now.
If you want to provide a patch and an upgrade path to enable to module(s) for existing enabled resources. BY all means, please assign this to yourself and mark it as active, otherwise this is a won't fix at this time.