Questions tagged [services]

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

Filter by
Sorted by
Tagged with
2
votes
0answers
44 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 ...
0
votes
1answer
44 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 ...
0
votes
0answers
47 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 ...
2
votes
0answers
46 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 ...
1
vote
0answers
45 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 ...
0
votes
2answers
45 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 ...
1
vote
1answer
163 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/...
0
votes
1answer
99 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....
0
votes
0answers
28 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 ...
1
vote
0answers
62 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 ...
1
vote
0answers
115 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 ...
0
votes
0answers
139 views

Making authenticated service call with dart (flutter)

I am attempting to make an authenticated call to Drupal 7 using services 3.7 in dart (Flutter framework) I can retrieve a token and login but when I make a call to; [ENDPOINT]/user/[USER_ID] I get ...
0
votes
0answers
327 views

Class not found in Drupal\Component\DependencyInjection\Container->createService()

I have a custom module (srs) that has an event subscriber as a service. That event subscriber class uses other custom helper class files after it catches the event. I tried to register the helper ...
0
votes
1answer
11 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 ...
0
votes
0answers
28 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 ...
1
vote
1answer
18 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 ...
0
votes
1answer
26 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?
1
vote
1answer
20 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'] ...
0
votes
1answer
35 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 ...
0
votes
1answer
92 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 ...
0
votes
1answer
619 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/...
5
votes
1answer
573 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 ...
-1
votes
1answer
122 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 ...
0
votes
1answer
38 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( ...
-2
votes
1answer
164 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 ...
0
votes
0answers
79 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 ...
3
votes
1answer
57 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 ...
2
votes
1answer
16 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' =&...
5
votes
1answer
61 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/...
0
votes
0answers
75 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 ...
1
vote
2answers
708 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 ...
0
votes
1answer
66 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 ...
0
votes
1answer
43 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 ...
1
vote
1answer
60 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 ...
0
votes
1answer
198 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 ...
0
votes
1answer
22 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 ...
0
votes
1answer
369 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-...
2
votes
0answers
31 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 ...
3
votes
2answers
365 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) { ...
0
votes
0answers
70 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; ...
0
votes
0answers
269 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 ...
0
votes
0answers
66 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. ...
1
vote
1answer
34 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 ...
0
votes
1answer
224 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 ...
0
votes
1answer
42 views

How to programmatically submit a form that has a file-field using drupal_form_submit()?

I'm working to allow the submission of an existing form via REST using the Services module and drupal_form_submit(). Though this is reasonably routine, the form in question takes a file-upload which ...
2
votes
0answers
1k views

Difference between service and plugin?

After have read some link i'm still confused about the difference between service and plugin. I am not speaking about plugin like block or Field formater etc... i would like to take an example : I ...
0
votes
1answer
503 views

Drupal7 REST Basic Authentication not working (Postman)

I configured my rest with services and installed the Basic authentication module. I used Postman and selected basic authentication gave username and password, I got "Missing required argument ...
0
votes
1answer
154 views

Field value not updating when posting data via JSON

Here I am getting 200 response but the date field over here is not getting updated. The node is getting created and other fields are getting updated, only this date field is not getting created. the ...
0
votes
1answer
1k views

Creating a simple Drupal 8 custom service - argument should be an instance of a class, recognised as an array

I'm kind of new to Drupal 8 development and object-oriented PHP in general. I've been trying to make a simple custom block module, which includes a service with simple dependency injection. However, I ...
1
vote
2answers
361 views

Access denied for user anonymous for node retrieve service

I have installed services module and added a service. And then, enabled the retrieve and index resources for node. I also enabled the permission to view the published content for anonymous users. ...

1
2 3 4 5
14