There is a hook_default_services_endpoint() to create a new service endpoint where I can programmatically enable my required resources in code but is there a way to programmatically search for an existing endpoint and if it is found, enable my module's resource for that endpoint?

Comments

kylebrowning’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)
colan’s picture

Status: Closed (won't fix) » Active

This is actually a support request so there's nothing to fix or not fix. It's a question.

colan’s picture

Version: 7.x-3.4 » 7.x-3.x-dev
samaphp’s picture

You can enable it Programmatically by add your resource to the endpoint using this way:

  $endpoint = services_endpoint_load('ENDPOINT_NAME');
  $endpoint->resources['RESOURCE_NAME']['operations']['index']['enabled'] = 1;
  services_endpoint_save($endpoint);

Of course you should change ENDPOINT_NAME to your endpoint name like 'api'.
And also change RESOURCE_NAME to your resource name that you want to enable.

Keep in your mind to set correct operation.
Try to print the endpoint data to see how it works.

  $endpoint = services_endpoint_load('ENDPOINT_NAME');
  print_r($endpoint);
samaphp’s picture

Status: Active » Needs review
marcingy’s picture

Status: Needs review » Active

There is no patch so status of the issue is wrong

colan’s picture

Status: Active » Needs review

Given that this is a support request, there's no need for a patch.

kylebrowning’s picture

Status: Needs review » Fixed

Right but what is there to review?

colan’s picture

#4, but since nobody's complained about it, let's say it's fixed. :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

nitin.k’s picture

As per Services module version: 7.x-3.13

for actions:


$endpoint = services_endpoint_load('service_name');
$endpoint->resources['resource_name']['actions']['action_name']['enabled'] = 1;
services_endpoint_save($endpoint);