Questions tagged [services]

The Services module provides a standardized solution for integrating external applications with Drupal.

Filter by
Sorted by
Tagged with
2 votes
1 answer
112 views

Change Priority of ServiceProvider class

I have a module, pod. I am attempting to alter another service (group.relation_handler.access_control.group_content_menu), by implementing Drupal\pod\PodServiceProvider::alter(). This is working ...
Jaypan's user avatar
  • 17.3k
1 vote
0 answers
61 views

Contrib module service overriding not working

I am using the ‘Path Redirect Import module along with the Redirect module. I am trying to override its service ‘path_redirect_import.importer’ To do this, I have added a service provider and a custom ...
Aurora's user avatar
  • 11
2 votes
1 answer
83 views

Using Drupal's Core classes as services

I have rather a general question that would help me to undestand using services in Drupal 8+ and when it is worth to do so. I have found a useful method createFromRoute which is part of namespace ...
Adamssef's user avatar
1 vote
1 answer
110 views

Using REST API services to create content with field entity references that do not yet exist

I'm using Drupal 9.4 and trying to create content via the REST API web services where one of the field's in this content is a reference to a taxonomy term that doesn't exists until the current node is ...
Patoshi パトシ's user avatar
0 votes
1 answer
95 views

Creating taxonomy terms via REST API using POST: proper formatting of json?

On Drupal 9.4 here and I want to create taxonomy terms via the api. Is there a good example of what I need to POST to an API end point?
Patoshi パトシ's user avatar
1 vote
0 answers
25 views

How to give ability to create custom NID numbers via API REST post when creating content?

I'm using Drupal 9.4 and I tried to pass in a nid value in my POST via the Drupal api. I'm getting the error: Response: {"message":"Access denied on creating field \u0027nid\u0027."...
Patoshi パトシ's user avatar
0 votes
1 answer
111 views

Creating content on via REST API using POST: proper formatting of json?

I'm trying to do a POST to create content on my site, but I get an Access Denied for creating field: changed even though I am an administrator role. When I remove the "changed" field in the ...
Patoshi パトシ's user avatar
0 votes
1 answer
49 views

How to disable the option time_restriction that honeypot add to the forms

In the README file for the Honeypot module, it says: If you want to add honeypot to your own forms, or to any form through your own module's hook_form_alter's, you can simply place the following ...
Oskar Calvo's user avatar
1 vote
0 answers
26 views

Which hook is invoked after an endpoint creates a node?

I am using Services 7.3x with Drupal 7. I have setup an endpoint that creates nodes. After a node is created by the endpoint, I would like to retrieve some data from the new node and update a third-...
Charlotta Beavers's user avatar
0 votes
0 answers
159 views

Title field returning ' where apostrophe should be?

I have a series of fields on a View. For some reason, any node title field with an apostrophe in it is being returned to my endpoint as Jen's Cupcake Store instead of Jenn's Cupcake Store. ...
Brittany's user avatar
  • 241
2 votes
1 answer
480 views

Return AccessDenied for custom page

I've setup a custom page in my system which is expecting 2 parameters that will be used to generate part of the content on that page, I'm able to retrieve the information from my page, but I'm ...
Andrew Morris's user avatar
2 votes
1 answer
962 views

Which is better way of injecting service to controller with __construct or $instance = parent::create($container)

I'm always using this way of injecting service to controller: <?php namespace Drupal\TestModule\Controller; use Drupal\Core\Controller\ControllerBase; use Symfony\Component\...
Drazen's user avatar
  • 27
2 votes
2 answers
180 views

Retrieving nodes tagged by multiple terms

Let's say I have an articles content type, and a field_tags reference field (with multiple values referencing a "tag" vocabulary) To retrieve articles referencing, say, "tag1" or &...
Hubert's user avatar
  • 143
0 votes
0 answers
52 views

Post Data to D7 from D9

How do I post data from Drupal 9 when a content is created, post data to Drupal 7 hosted in a different server to create node content. In Drupal7, I have enabled services module and created a resource ...
shablm's user avatar
  • 99
0 votes
1 answer
145 views

How to keep similar custom services from conflicting?

I have two modules, each of which is defining a normalizer service module_one.services.yml services: module_one.normalizer.node_entity: class: Drupal\module_one\Normalizer\...
schnippy's user avatar
  • 5,339
2 votes
0 answers
956 views

Add custom Twig extension [closed]

I need to output a JSON variable in my theme, data is saved in a node field. I can easily use hook_preprocess_node to decode the data and save it in axillary variable and then render it using a custom ...
Alireza Tabatabaeian's user avatar
0 votes
1 answer
682 views

Uploading an image with JSON:API; getting "Access denied"

I'm attempting to upload an image with JSON:API. I have added an Image field (not a media field) to the user entity. In Postman, I get a session cookie for testing. Then, in accordance with Flow 2 in ...
Patrick Kenny's user avatar
0 votes
0 answers
122 views

Discover custom services with drush generate

When I create a module and a custom service with drush generate and then create another service, also with drush generate, the first one is not available to inject. What is missing to make it become ...
uniquename's user avatar
2 votes
0 answers
47 views

Make sure that the overriding service 'wins' [duplicate]

Setup I have multiple sites that are very similar and therefore share the same code base. I have a custom module common with functionality common to all sites. Then for each site I have a specific ...
Nicolaj's user avatar
  • 163
1 vote
0 answers
87 views

Decorating current_route_match service inexplicably causes fatal errors in webforms (and possibly elsewhere)

When decorating the current_route_match service I'm seeing issues with various webform requests (either fatal errors or ajax responses making no changes) when navigating past page two of a multi-page ...
Dylan's user avatar
  • 121
0 votes
2 answers
206 views

Alter Services JSON Response

I have created a view to render all taxonomy terms and displayed it through a service. I have also created an endpoint in the service module to hit the url through firefox add-on RESTer to test the ...
Souvik Das's user avatar
1 vote
1 answer
1k views

How to check config setting in custom service class with dependency injection?

In a custom Service class, I need to check a config setting. I'm able to do this using \Drupal::config(static::SETTINGS) as documented here: https://www.drupal.org/docs/drupal-apis/configuration-api/...
hotwebmatter's user avatar
  • 2,102
0 votes
1 answer
672 views

How do I handle exceptions in a service class? [closed]

I have implemented a Service which does stuff with a RESTful API: services: api.clientname: class: Drupal\my_custom_module\Api\Clientname arguments: ['@http_client', '@messenger', '@logger....
hotwebmatter's user avatar
  • 2,102
0 votes
0 answers
80 views

REST API and Multi value date field

I have a React native front end with D7 backend. I am populating a content type that has a multi-value Date field. I am successfully creating the content-type with all other fields except the Date ...
Rahul T K's user avatar
1 vote
0 answers
63 views

When should I create a service for a class? [duplicate]

It seems that in Drupal code anything that is neither hook nor Plugin nor Controller nor any other thing with a standard functionality should be a Service. For sure, services make sense when we want ...
Philipp Zedler's user avatar
1 vote
0 answers
149 views

What is the exact process of resetting a password using Node.js?

I am using Node js as front end and drupal as backend, i am trying to develop a reset password api. As per my finding there are three steps for the same. Request a Password (Send an email with secure ...
helpdoc's user avatar
  • 73
0 votes
1 answer
16 views

I am unable to post image references

I have had this module working for years. Recently, it has stopped working. I'm using Services 3 to: Log in and get a token Create an image file and get its file ID Create a node, using the file ID ...
xpersonas's user avatar
  • 522
0 votes
0 answers
31 views

Services module retrieve node with PHP text format

I have successfully connected to a Drupal instance using JSON and even retrieved a node using the service. Problem is that the node has php content type, and the service returns the raw php content ...
user96933's user avatar
1 vote
1 answer
24 views

Storage API + Services 3: How to work together?

I am trying to set up a site that will be storing a large amount of images. I am using Storage API module for that and It is working fine through web. Now I need a REST Service to upload images. I am ...
Alfonso_MA's user avatar
0 votes
1 answer
34 views

Prevent login except from Services

I would like to prevent my users to login except for those who login through my REST Service. Is that possible?
Alfonso_MA's user avatar
1 vote
1 answer
32 views

How to add v1 when specifying the URL of an API?

I'm creating an API service using Services (Drupal 7) and would like to create an URL like /api/avu/v1/{id}. I have api in Path to endpoint and in hook_services_resources() I have $resources['avu'] ...
NicklasF's user avatar
  • 289
0 votes
1 answer
53 views

Cannot assign roles creating User through REST endpoint

Sidenote, already seen this page, doesn't seem to help: How to create user with role(s) through REST service? I've setup a new endpoint on my platform to try to allow a 3rd party to create users on ...
Andrew Morris's user avatar
0 votes
1 answer
234 views

How can I pass parameters to a Services endpoint?

I have installed Drupal 7 and enabled Services in it. I have also created an endpoint /api/v2/ and in resources, I have allowed nodes to be listed as JSON. I have sent a GET request using browser or ...
Optimum Creative's user avatar
0 votes
1 answer
2k views

How to create Dynamic Routes

I have been trying to create dynamic routes by using RouteSubscriberBase class. I know we can create dynamic routes by using slug parameter in the URL. Similar to this method ( https://befused.com/...
miststudent2011's user avatar
11 votes
1 answer
3k views

What is the difference between \Drupal::request()->getSession() and \Drupal::service('user.private_tempstore')?

As the title suggests, I'm a bit confused about those two methods of creating and accessing a session on Drupal 8. I'm not quite sure when to use the one over the other, could someone point me to the ...
user avatar
-1 votes
1 answer
142 views

Let 'web-view' mobile iOS/Android app talk consume/feed site [closed]

I have a Drupal 8 site with the following modules: HAL. HTTP Basic Authentication. REST UI. RESTful Web Services. Serialization. Using the REST UI module, I configured it as follows. Settings for ...
Elie Masaad's user avatar
0 votes
1 answer
60 views

Order relationship in RESTful

I'm using https://www.drupal.org/project/restful module. I can sort base entity using annotation: /** * Class Things__1_0 * @package Drupal\restful_thing\Plugin\resource\node\thing * * @Resource( ...
cssBlaster21895's user avatar
-2 votes
1 answer
442 views

How to filter Data on the basis of id or uuid by Rest API?

I am using Drupal 8 I have installed the poll module. I created a view with REST export enabled. Now when I get the data by this url http://localhost/poll/rest/polling I am getting all the data of ...
Mohd Maaz's user avatar
  • 103
0 votes
0 answers
118 views

How to fetch field value via REST

I am using Drupal 8. I have installed the Rest module. I need to do polling so I also installed the Poll module. I created two questions with choices in poll and after that I created a view to show ...
Mohd Maaz's user avatar
  • 103
3 votes
1 answer
138 views

Pass parameters for node access on RESTful call

I'm trying to figure out how to pass a filter parameter on a Services rest call. I've got a node of a specific type that I'd like to access through the Services module and rest. I'm testing with ...
rrirower's user avatar
  • 349
2 votes
1 answer
22 views

Webservice args types automatic validation

It's a Drupal 7 with Webservices module, and there is a service with something like this (example): 'create-product' => array( 'operations' => array( 'create' => array( 'help' =&...
Raf A.'s user avatar
  • 155
5 votes
1 answer
118 views

Module Uninstall Validators and Lazy Services

I have recently been working on creating functionality for a module that requires certain content related to the module be deleted before the module itself can be uninstalled. https://www.drupal.org/...
Stephanie Galata's user avatar
0 votes
0 answers
105 views

Upload a JSON from a third party application

I have a client hosted on Acquia, and they are requesting that we implement functionality to allow another companies 3rd party application to upload a JSON file to an upload directory within their ...
DMAC's user avatar
  • 1,053
2 votes
1 answer
2k views

Dependency Injection if service exists

Is there any way to use dependency injection in a conditional way, i.e. only if a service exists similar to \Drupal::hasService(). I have a created a service in module A and in module B I have an ...
Tobias's user avatar
  • 21
0 votes
1 answer
83 views

Can I connect via REST services with a mobile app I will develop?

I'm thinking of developing an e-commerce with Drupal 8 and Drupal Commerce, but I need to know if I can connect via REST services with a mobile app that I would develop too. The app would need to be ...
Luis's user avatar
  • 11
0 votes
1 answer
70 views

How can I get a user by email address using a service?

I have a custom service that I created to do some stuff with users. I want to be able to GET and DELETE users by email address because I may not know the uid. I have the service set up now. It works ...
BrandenB171's user avatar
  • 1,112
1 vote
1 answer
237 views

Redirect user on specified route

I know we can easily redirect a path to another path with Redirect module, but what I want to do is more complicated, my condition is when the user has a specified IP and the route is matched with to ...
Yuseferi's user avatar
  • 21.8k
0 votes
1 answer
233 views

Services module, custom endpoint & authentication

I have a have setup a custom endpoint via services and a REST server the custom end point looks like this, https://website.local/api/v1/druaplsquare The custom endpoint is built using the following ...
Udders's user avatar
  • 103
0 votes
1 answer
32 views

POST from external source

I have external site that needs to POST my drupal site (it basically shares data). I need to take the POST data parse it and create a node from it. Is this possible? I have created a PHP file ...
Udders's user avatar
  • 103
0 votes
1 answer
765 views

Add a condition to show menu link in YML

how should I do if I need to show to a link menu based on a condition ? This is my YML for my menu link : double_vue_klesia.backuserswitch: title: 'Retour user précédent' menu_name: navigation-...
Morgan Tartreau's user avatar

1
2 3 4 5
14