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

gdd’s picture

Status: Active » Postponed

Trying to clear out the 7.3 issue queue, will move these to 7.4 when it opens

ygerasimov’s picture

Very 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.

jamielennox’s picture

I 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.

marcingy’s picture

By 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.

jamielennox’s picture

upon 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

voxpelli’s picture

I'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.

seandunaway’s picture

But it didn't workout well for Views support.

The quantity of maintainers/contributors and number of installs help ensure the resources are maintained.

g10’s picture

+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)

kylebrowning’s picture

Re: #8 that sun true, use drupal_alter('services_resources', $resources, $endpoint);

g10’s picture

@kyle, tnx for the tip! was not aware of that hook
this does the trick indeed:

function hook_services_resources_alter(&$resources, $endpoint) {
  unset($resources['user']);
}
kylebrowning’s picture

Status: Postponed » Closed (fixed)

Wont fix in 3.x but ive added it as a list of things to do for 4.x

fuzzy76’s picture

Version: 7.x-3.x-dev » 8.x-4.x-dev
Issue summary: View changes
Status: Closed (fixed) » Active

If it's not actually done yet, I guess it's not fixed. :)

marcingy’s picture

Status: Active » Closed (won't fix)

This was closed on purpose by a maintainer

fuzzy76’s picture

It 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.

kylebrowning’s picture

We 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.