Questions tagged [services]

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

-1
votes
0answers
47 views

The right way override method on Condition query? [closed]

Current I want to change some logic of method translateCondition on file web/core/lib/Drupal/Core/Entity/Query/Sql/pgsql/Condition.php. But I don't know the right way how to override this method. I ...
0
votes
1answer
19 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
27 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
41 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
23 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
45 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
124 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
51 views

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

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
24 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
38 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
46 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
41 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 ...
0
votes
0answers
338 views

How to upload a base64 encoded image using API

I am trying to submit enquiry form using api. I am able to post data through api by using the endpoint Endpoint: url/contact_message?_format=json Body: { "contact_form":[{"target_id":"...
3
votes
1answer
43 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
16 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
49 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
212 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
28 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
35 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
49 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
77 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
82 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-...
0
votes
0answers
31 views

Is there any possible way to know how hook_services_resources() is implemented?

I have received the source code and the database backup of a live application. When I tried to discover its services, I found out that many custom services are implemented through custom modules, ...
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
336 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
37 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
227 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
22 views

How to login in two different drupal sites at the same time

I'm trying to log in to two different Drupal installations in the same domain. For example, I have site1 (Drupal 8) and site2 (Drupal 7). If I login to site1, user will be automatically logged in to ...
0
votes
0answers
81 views

GET list of all roles on Drupal 8 via REST

I work on a server SCIM and I need to list the roles existing in my Drupal site (for Drupal 8). In fact, I need to know the existing roles to create a user with a specific role on drupal but using a ...
0
votes
0answers
34 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
28 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
215 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
20 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
438 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
586 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
242 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
56 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
426 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
218 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
108 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-...
-1
votes
1answer
46 views

Services PATCH multiple target_id values for entity (node)

I'm trying to pass multiple nids to my node to match this structure: [field_sac_testts] => Array ( [x-default] => Array ( ...
0
votes
1answer
88 views

How do I parse application/vnd.surveymonkey.response.v1+json?

I recently asked a question about setting up SurveyMonkey webhooks here: https://drupal.stackexchange.com/questions/252571/surveymonkey-v3-webhook-callback After laborious troubleshooting, I've ...
1
vote
1answer
419 views

How do I use a “contains” operation as restful contextual filter for text fields

I'm trying to create a restful view which takes a string as input, search specific content-type titles for similar nodes and return them as result. The problem is I can't figure out how to configure ...
0
votes
3answers
52 views

How do I create a view that uses data from an external site

I have a site that needs to get articles data from a view in site A in order to display these articles as a view in site B. I found the module Services Views, which i don't completely understand. I ...
0
votes
2answers
136 views

Register user with empty password

I create a cordova app, and trying to register new user from my app using drupa 7, drupal 7 service 3 and angularjs 1. I send post request with below data and user created successfully. $http({ ...
0
votes
1answer
2k views

Request header field X-CSRF-Token is not allowed by Access-Control-Allow-Headers in preflight response for Drupal 7 REST API

I have few APIs created in Drupal 7 which uses session authentication. Now when I get the CSRF token and try to use it in my API call, I get following error: Request header field X-CSRF-Token is not ...