Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [services]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 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. ...
user avatar
  • 239
2 votes
1 answer
80 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 ...
user avatar
3 votes
1 answer
89 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\...
user avatar
  • 31
2 votes
2 answers
45 views

Drupal JSON:API - 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 &...
user avatar
  • 143
0 votes
0 answers
25 views

Transform the view mode of a content type into the class of the body

I want to add the view mode of my content type as a class to body and I use Display Suite so $node['view_mode'] is not available. In MYTHEME_preprocess_html(&$variables), I injected the service \...
user avatar
  • 223
0 votes
0 answers
21 views

How to change user password with Services 3.x?

I make a mobile app using Services 3.x module and Drupal 7. I would like to add a functionality for users to change their own password but I did not find a way to do it. I read and tested this, but it ...
user avatar
  • 101
0 votes
0 answers
27 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 ...
user avatar
  • 99
0 votes
1 answer
72 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\...
user avatar
  • 5,339
2 votes
0 answers
212 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 ...
user avatar
0 votes
1 answer
279 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 ...
user avatar
0 votes
0 answers
62 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 ...
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 ...
user avatar
  • 163
1 vote
0 answers
52 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 ...
user avatar
  • 121
0 votes
2 answers
62 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 ...
user avatar
1 vote
1 answer
546 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/...
user avatar
  • 1,939
0 votes
1 answer
278 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....
user avatar
  • 1,939
0 votes
0 answers
43 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 ...
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 ...
user avatar
1 vote
0 answers
127 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 ...
user avatar
  • 73
0 votes
1 answer
12 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 ...
user avatar
  • 480
0 votes
0 answers
30 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 ...
user avatar
1 vote
1 answer
19 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 ...
user avatar
0 votes
1 answer
30 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?
user avatar
1 vote
1 answer
21 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'] ...
user avatar
  • 236
0 votes
1 answer
47 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 ...
user avatar
0 votes
1 answer
136 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 ...
user avatar
0 votes
1 answer
980 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/...
user avatar
7 votes
1 answer
1k 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
133 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 ...
user avatar
0 votes
1 answer
42 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( ...
user avatar
-2 votes
1 answer
265 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 ...
user avatar
  • 103
0 votes
0 answers
103 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 ...
user avatar
  • 103
3 votes
1 answer
63 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 ...
user avatar
  • 349
2 votes
1 answer
18 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' =&...
user avatar
  • 155
5 votes
1 answer
82 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/...
user avatar
0 votes
0 answers
80 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 ...
user avatar
  • 1,045
1 vote
2 answers
998 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 ...
user avatar
  • 11
0 votes
1 answer
73 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 ...
user avatar
  • 11
0 votes
1 answer
56 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 ...
user avatar
  • 1,074
1 vote
1 answer
72 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 ...
user avatar
  • 20.6k
0 votes
1 answer
221 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 ...
user avatar
  • 103
0 votes
1 answer
26 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 ...
user avatar
  • 103
0 votes
1 answer
504 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-...
user avatar
2 votes
0 answers
32 views

how can I retrieve correct routes for rest resources?

I installed drupal 8 on my local server. I enabled all web services modules and installed rest ui module. I enabled some rest resources, such as entity/menu. Now, I need to know how to get correct ...
user avatar
3 votes
2 answers
366 views

Cannot update checkbox with services

I have been trying several configurations for trying to update a user account checkbox to uncheck it, with no success. I have been able to check it without issue. updateCharType = function (token) { ...
user avatar
  • 2,201
0 votes
0 answers
81 views

delete or disable service endpoints programmatically?

I am trying to programmatically disable a service endpoint, but I am not able to achieve it using the following code. $endpoint = services_endpoint_load('my_service'); $endpoint->disabled = TRUE; ...
user avatar
  • 125
0 votes
0 answers
299 views

How to create a table in second database with hook_schema

I want to use two databases, that works following: How can I setup multiple database connections in Drupal 8? . I can set the connection in the settings.php file, access it by injecting a different ...
user avatar
0 votes
0 answers
73 views

Is it possible to use taxonomy term's field as exposed filter in Services Views?

I would like create a REST endpoint which would allow a user to pass a query parameter that is incidentally a field of a taxonomy term. I am trying to achieve this by using Services Views in Drupal 7. ...
user avatar
  • 103
1 vote
1 answer
41 views

User registration through service

I have a local Drupal instance with services. I created an endpoint that has user resource included. I verified that all is well by logging in using the endpoint. I am now stuck at registering new ...
user avatar
0 votes
1 answer
225 views

Retain content while deleting user using services

I need to delete a user account using services module & does it fine. I can see that content(forum) created/updated by the user gets deleted. Is it possible to achieve below screenshot option ...
user avatar

1
2 3 4 5
14