Questions tagged [services]

The Services module provides a standardized solution for integrating external applications with Drupal. In Drupal 8 services are defined in YAML, they help to decouple reusable functionality.

Filter by
Sorted by
Tagged with
-3
votes
0answers
23 views

Use Mobile number to authenticate user in a whatsapp way [closed]

i am creating an ionic mobile app that consumes and uses Drupal Services , and the clients is requestig to use mobile number method to authenticate just like whatsapp ..is there anyway to do this ?! ...
0
votes
0answers
34 views

How to inject a service into a callback in ajax form? [closed]

I can't access to my injected service from inside a form #ajax callback method : this is the form element that triggers the #ajax callback ( which is an external class method): /src/Form/...
0
votes
1answer
16 views

How to write SoapClient request which has basic auth in it?

Actually I need to implement SoapClient in Drupal 8. Following XML is Request: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://www.example.com/common/...
1
vote
1answer
24 views

Set parent service when registering a service in a ServiceProvider

I want to create dynamic services, therefore I added a ServiceProvider class to my module. I have created a base service that my other services will have as parent. When doing this in my_module....
0
votes
1answer
17 views

REST Api user login

I'm working on a react-native application with a clean D8 setup. I'm new to both. For some reason, my asyncstorage is being cleared on the emulator so I land on the login page even though I have an ...
0
votes
0answers
19 views

Export data in csv via REST

I have data which is managed by a custom module. My goal is to provide a REST endpoint where users can get the data in csv format. The user have to authenticate themselves in order to get the data. ...
0
votes
0answers
25 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 ...
0
votes
0answers
11 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
2answers
43 views

How add pager with external request

After many search and read posts, I'm still stuck with my code. Let me explain : I created a custom module who display newsletters from Mailjet and old newsletters comming from drupal. To avoid the ...
0
votes
1answer
19 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?
0
votes
0answers
31 views

Remove URL parameters

I am trying to update an user using the Services module. It is working fine with a request like that: D/OkHttp: --> PUT http://example.com/api/user/20 D/OkHttp: Content-Type: application/json D/...
0
votes
1answer
16 views

Specify the URL

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'] ...
2
votes
1answer
23 views

User register endpoint showing notifications

I'm trying to setup an endpoint for a 3rd party app to allow users to be created on my site through a REST endpoint, which is mostly working so far, although, I've just navigated to my site through ...
0
votes
1answer
12 views

Is it possible in a PATCH call to restrict edition by field?

I am using RESTful Web Services in Drupal 8. I have successfully made a PATCH to edit some fields of a content. What I want to do now is to restrict the edition to only some fields of the content. ...
0
votes
0answers
24 views

How to format Rest API response

I am using drupal 8 REST API and I tested /user/login?_format=json for login. { "current_user": { "uid": "593", "name": "askeraa@asample.aa" }, "csrf_token": "...
0
votes
0answers
11 views

Limit the number of REST sessions per authenticated user

Is there a way through a hook or otherwise to limit the number of concurrent REST sessions an authenticated user can have? I want to be able to limit a user to say no more than five concurrent ...
0
votes
1answer
26 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 ...
1
vote
1answer
99 views

How to post node tags using REST API?

There is no problem with a node creation with filled in title/body/custom text field fields using REST API. We just need to send a post request with the following body: { "_links": { "type": { ...
0
votes
1answer
31 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
0answers
80 views

Services: Updating file/image on server

I'm able do retrieve, delete an image from Drupal server using services https://example.com/entity/file/[fid] But I couldn't able to do the same for updating. I tried like follows to update the ...
0
votes
1answer
75 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/...
0
votes
0answers
38 views

Service decorator for entity list builder?

Is it possible to use a service decorator, or similar mechanism, to override a method in an entity's list builder? For my specific use case, I want to override the render() method of the Drupal\...
0
votes
1answer
342 views

How can I avoid getting “This route can only be accessed by anonymous users”?

I'm trying to use REST login from a React native app. When the user tries to log in, the app calls: var data_node = {name:this.state.username,pass:this.state.password}; axios.post('http://IP/user/...
0
votes
0answers
15 views

Disable authcache for webservices

Is there anyway I can disable caching for web services? After I installed and enabled authcache, I've begun to have troubles with webservices queries due to caching. If I disable authcache, all runs ...
4
votes
1answer
174 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
71 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
28 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
75 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
51 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
53 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' =&...
3
votes
0answers
22 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
60 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
1answer
383 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
41 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
41 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
51 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
126 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
20 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
203 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
29 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
347 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
48 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
247 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
52 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
31 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
220 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
27 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
599 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
860 views

How to Logout user with Basic auth?

I can log in, perfectly fine, but can't get logout to give me a JSON response. Currently, I can only do POST to d8.com/user/logout?csrf_token=123&?_format=json and that would log out, even ...