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
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
26 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
17 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
26 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
15 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
11 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
21 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 ...
1
vote
1answer
24 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
54 views

How to post a 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
24 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
47 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
52 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
31 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
0answers
113 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
140 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 ...
0
votes
1answer
58 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
27 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( ...
0
votes
0answers
39 views

How to do poll by POST request?

I have installed poll module. i want to do polling via POST request for that i hit the url http://localhost/poll/entity/poll_choice with the following body in postman { "_links": { ...
-2
votes
1answer
60 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
45 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
48 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 ...
0
votes
0answers
18 views

Content moderation module that integrates well with Services (rest)

I am looking for a content moderation/workflow solution that will integrate with the Services module. I would like to update and transition the workflow state of a node using an api. Currently, I am ...
1
vote
1answer
15 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
21 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
55 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
304 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
36 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
40 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
99 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
19 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
142 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
28 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
346 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
44 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
238 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
41 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
217 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
23 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 ...
1
vote
0answers
522 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
735 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 ...
0
votes
1answer
312 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
73 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
515 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
239 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. ...
0
votes
0answers
109 views

Oauth_server authenticates but subsequent requests return “True” with 403 Unauthorized status

I have successfully setup Oauth2 in Drupal 7 and I am able to get token from the Oauth2/token endpoint. I need to implement, Implicit Flow (Client-Side Flow) as this endpoint will be used by client-...