Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

The tag has no usage guidance.

0
votes
0answers
16 views

PATCH request replaces value in entity reference field instead of creating new

I have an entity reference field named order_entryin my crm core individual, the problem is that when I try to PATCHthe user and send new order there, it replaces the order instead of adding new ...
1
vote
1answer
41 views

REST GET ResourceResponse returns encoded json

I have a decoupled drupal project with an angular 5 front end that is utilizing a restful api to store data. Because this API needed a key that we didn't want to expose we have created a restful ...
-1
votes
1answer
47 views

Views & JSON API

I can see Drupal 8 Views support REST Export. But not JSON API. So how to integrate Views with JSON API? https://www.drupal.org/project/jsonapi
0
votes
2answers
34 views

Permission issues with Custom Content Entity exposed to REST API

I hope it's not a duplicate entry. I've recently created my Custom Content Entity within a Custom module and I'm currently having trouble with permissions. (Please see permissions below) The ...
1
vote
1answer
34 views

REST for nested paragraphs

I need to create a rest service that delivers the current data: getNode(nid) -> all node fields -> if field is entity reference (like file, human readable urls) -> include subfields -> ...
0
votes
0answers
25 views

How to post JSON data into dblog in drupal 8?

I have created a custom module naming "razorpay". My routing file look like this:- razorpay.webhook: path: /razorpay/webhook defaults: _controller: '\Drupal\razorpay\Controller\...
2
votes
0answers
63 views

Filter by taxonomy parent using Json api

In drupal 8.5 I have a taxonomy term list like this: Term A (12 items) Term 1 (3 items) Term 2 (8 items) Term 3 (1 items) Term B (3 items) Term 4 (1 items) Term 5 (2 items) I want to use ...
0
votes
0answers
17 views

Login using REST request gives 404

This is so simple login request but cannot figure out why I am getting such error message when trying to login using Postman. I use url http://localhost:8080/user/login?_format=json and input in the ...
0
votes
0answers
46 views

How to install the JSONPath library?

I use the "Feeds JSONPath Parser" module. But I get a message like: The JSONPath library is not installed. How install JSONPath library?
2
votes
1answer
89 views

Simple OAuth + JSONapi response when token is expired - Decoupled

We're using the 'Simple OAuth' and 'jsonapi' modules for the front end authentication in Angular of our decoupled Drupal project. We've noticed that when the user credentials are correct but the ...
1
vote
1answer
18 views

How to prevent my ZURB theme from stripping out part of the JSON LD element?

I use ZURB theme and following I post the code of my template.php file. My problem is, that type="application/ld+json" in <script type="application/ld+json"> gets stripped out so it is rendered ...
0
votes
1answer
29 views

Execute some steps before REST POST request

I have created a custom content type and configured it to be created via REST POST method using REST client like POSTMAN or any frontend(like angularJS or react). I want to execute few steps before ...
0
votes
1answer
65 views

Use JSON instead HTML for access denied on some custom paths

I create a small API for one project using Bathic Authentication. The API consists of some custom paths defined in routes in a custom module. Using JsonResponse() in the controller we send back a JSON ...
0
votes
0answers
52 views

How do I create a custom JSON API endpoint?

I would like to create a custom JSON API endpoint to preview nodes in draft status. The URL will be something like "jsonapi/node/page/preview". If a page node has a draft in progress, it should be ...
0
votes
0answers
27 views

add multiple values By restful api

i have problem in multiple values using RESFUL API in Drupal 8 i have field it has multi values in it, but when i did patch Method to add another value, all the values that in the field before will ...
2
votes
1answer
62 views

How do you upload an image via jsonapi?

The documentation is vague: https://www.drupal.org/docs/8/modules/json-api/working-with-files-post I am trying to upload an image following the sample code given for uploading a "document" on above ...
1
vote
0answers
12 views

Accessing element in REST export view json response

I have an API created from a REST export view, now im trying to do some behat test, but im getting some strange/different result when accessing an element in the json formatted response. Using this ...
0
votes
0answers
19 views

What content-type should I use in my header when POSTing data to Drupal 8 with fetch?

I am trying to POST a json string to Drupal 8 from my javascript application, using fetch. It doesn't work at all unless I use 'applicaton/x-www-form-urlencoded' as my content-type. When I use '...
1
vote
1answer
85 views

How to convert the drupal-entity tag into an img tag?

I have a content type with a text field that uses CKEditor, in the editor is possible to add a media entity image, once the image is inserted inside the text the html tag for it is: <p>Document&...
0
votes
1answer
23 views

how to adjust installer path in JSON file to customize vendor dir

Before using 'composer install' I edit extra installers paths. Example: edit /web to /a-custom-docroot folder where is placed core, modules and all other folders. When possible I would like to ...
0
votes
1answer
33 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
0answers
18 views

Working example of blueprint (subrequest) to create a paragraph and associated entity?

I'm using the subrequests and paragraphs modules. Without a code example, it's daunting to try to build a working blueprint for the subrequest, when I haven't used either module before. I have ...
0
votes
1answer
80 views

REST API 401 Unauthorized

I am trying to create a new node with POST through REST in D8. I have enabled the relevant modules (hal, serialization, http basic authentication, Rest web services, rest ui) and added the required ...
1
vote
1answer
32 views

what json structure does simple oauth expect?

Drupal 8. I'm new with simple Oauth. I had manage to do this: But I want to do it with the Raw format, cuz my frontend is in Angular, so I will send a Json to Drupal. This is my first try: { ...
0
votes
0answers
52 views

How to get the JWT token via webservice

After enabling the JWT module. and following Using JSON Web Tokens (JWT) to Authenticate Requests to REST Resources in Drupal 8 on how to use it, it is working. I know I can access the user JWT ...
0
votes
0answers
35 views

Add number of records to display as a contextual filter in views rest export

I have a Rest Export view and want to add the count of results to display as a contextual filter like this when for example hit this URL:- mywebsite.com/api/get-articles/2 this will return only two ...
0
votes
1answer
24 views

Create a Json view of the user, with the format of the user/login response

I'm in Drupal 8. After activating the module rest, and try and receive a response from the route /user/login?_format=json I get this: { "current_user": { "uid": "4", "name": "...
0
votes
1answer
25 views

Send user email through rest services

I made a view, with a contextual filter in the user id. The fields are: Name uid Email. [ { "username": "pruthiswebar", "id": "8" } ] If I am logged, I can see the email, ...
1
vote
0answers
35 views

Views export in jsonapi format

Drupal 8 offers a "REST export" views display. What would be the best way to get an export according to the jsonapi specification? Should I think in terms of creating a new views display, so the view ...
1
vote
0answers
59 views

How do I add CacheableMetadata to an array I'm returning in a rest resource?

I'm getting the following error, which I've seen in several other questions, but as yet I haven't been able to make any of the example solutions work: LogicException: "The controller result claims ...
0
votes
0answers
85 views

Contextual filters in views rest export for decoupled website

I'm running a Drupal 8.3.2 site and currently explore the concepts of using Restful webservices, jsonapi and React.js in a progessively decoupled project. I installed the jsonapi module and fetched ...
0
votes
1answer
84 views

Json api create comments

I am using the JSON API module and I would like to create a comment. I was able to create nodes based on the documentation found here, but I can't figure out how to create comments. How can I add a ...
0
votes
0answers
24 views

Migrate using Paragraphs - D7

I have this working already for D7 using the Field Collection and Migrate modules, but I was hoping to change from Field Collections to Paragraphs in preparation for writing this for D8 eventually. ...
0
votes
0answers
51 views

Get drupal_add_js files from drupal_json_output

I've a page callback reload_page to get the my_page data in JSON format as follows //menu link - reload-page function reload_page(){ $reload = my_page(); return drupal_json_output(array('...
0
votes
0answers
87 views

Views Rest Export returns content ID as String instead of Int

I'd like to use Drupal 8 (tried both 8.4 and 8.5rc1) as a headless CMS. I'd like to see the node ID being returned as Int, instead of String. According to a Drupal issue, new installations should ...
0
votes
0answers
51 views

Create page to display results from external JSON response?

I've got a webform set up that, when submitted, makes a GET request to an external service. This service provides me with a JSON response full of results. I've managed to convert the results to an ...
-1
votes
1answer
20 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
2answers
133 views

How can I include Google Structured Data via a module?

Looking through Google's suggestions of search optimisation for a site that I control, I would like to add their "Structured Data" JSON to various pages on the site. Their suggestion is to include the ...
2
votes
0answers
170 views

Accessing Drupal REST endpoint using Oauth 2 token

I have successfully installed the Simple OAuth module on my website. I am also able to authenticate to it using Postman. I am getting the access_token and the refresh_token when authenticating. ...
0
votes
0answers
177 views

How to denormalize an entity references in a content?

I work on a REST feature to transfert contents between 2 sites. I can send contents with basic fields but I have a problem when I try to unserialize contents with entity references where the entity ...
0
votes
1answer
145 views

How to process an http request with a controller?

I try to write a custom Restful API to send contents between two drupal site. The present code work except the datas are in a weird format with @ in the json. My resquest is: $serializer = \Drupal::...
1
vote
1answer
142 views

Basic Page POST request to Contenta JSON_API endpoint fails

UPDATE 2: Wow... Seems that if I manually request an OAuth token and then copy/paste that into an Authorization: Bearer ... header manually, my POST request works!!! Why the built-in Postman OAuth2....
0
votes
0answers
134 views

Decoupled Subrequests POST issue

I'm struggling to get a basic subrequest POST working, based on the API provided by Contenta, and the examples I've found on the drupal.org subrequests module page. I'm running into the following ...
0
votes
0answers
23 views

field_image path url in services

I am using services module in D8 to retrieve node data via JSON. The returned JSON does not have field_image url or path. I want to use this URL to display images in my app. Is there any settings / ...
2
votes
2answers
3k views

405 Method Not Allowed Error when making a JSON API request from a simple create-react-app

The following request is giving me a 405 Method not allowed when running from a simple create-react-app generated project from localhost:3000. I really need this app to run outside of the domain (...
0
votes
1answer
32 views

Save boolean data types in serialized array

I'm writing a CRUD front end application that talks to a hand-written Drupal endpoint. The data I'm pulling from the database is serialized in one field, or cell. It comes out as a keyed array. One ...
0
votes
1answer
488 views

Fetching(GET) image url with applied image styles using jsonapi module

Looking to make request using the jsonapi module to GET all urls that point to the images optimized version of the image. If I use the Drupal front-end with Twig and view my page and inspect the ...
0
votes
0answers
107 views

Drupal 7 views: Generate custom JSON output using Views Data export JSON plugin

Currently I'm tasked with generating the following output of the JSON. { "JsonStatus": { "success": true, "code": 200, "description": "Action Successful" }, "...
0
votes
1answer
674 views

Drupal 7 Views Module output 'Access-Control-Allow-Origin' header

I have created a view (via the views module) which outputs a JSON output (minus the template etc) I have loaded the page and it outputs data as required. I now need to call this page from another ...
1
vote
1answer
331 views

Store field values in a JSON file on Drupal 8?

I'm building a booking calendar module, and want to get back arrival & departure datefields values to highlight reservations on the calendar, passing to a library the variables. public function ...