Questions tagged [json]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
4 views

How to make work Restfull /user/register?_format=hal_json

I am trying to access. All required modules are included, rights granted. so does not work. /user/register?_format=hal_json I get a message: {"message":"Not acceptable format: hal_json"} In RestUi ...
0
votes
0answers
18 views

No route found for POST

I've been working on a custom rest module for Drupal. I wrote the following Resource class. <?php namespace Drupal\aker_platform\Plugin\rest\resource; /** * Provides a License GET Resource ...
0
votes
1answer
26 views

Looping through an array using Migrate Plus

I'm trying to loop through an array (called "Attributes") in a JSON migration source, but I can't figure out how to do it. Here's a shortened sample of my data source: [ { "Id": "ST00000002", ...
0
votes
0answers
17 views

Access denied on creating field 'status'

Uploading image via API http://drupal.local/entity/file?_format=hal_json API responding error Access denied on creating field 'status' when adding status field. I am using that API with credential of ...
1
vote
1answer
63 views

How to handle the cache per user in REST Resource?

I have a requirement to expose a specific content type data via REST end point. Below is my code: public function get() { $current_user = $this->currentUser->id(); $user = $this->...
1
vote
1answer
28 views

How to get the referenced entity name instead of target_id in Normalizers?

I am working on exposing the article type content via REST in JSON format. I am using Normalizers to generate the required data format. Normalizer: use Drupal\serialization\Normalizer\...
1
vote
2answers
32 views

How can I hide nodes from view, but open access to JSON:API at the same time?

I would like to use Drupal as a decoupled system, sourcing its content by using Gatsby. Having set it all up, I would like my Drupal nodes not to be accessed by random unauthenticated users so I ...
0
votes
0answers
15 views

json file from authenticated api location

GET https://clubapi.prosoccerdata.com/teams HTTP/1.1 x-api-club: x-api-key: Authorization: now i need to setup the query settings to a secured json location where headers are needed how add these ...
0
votes
0answers
11 views

How to get user data/authenticate with bearer token - Simple OAuth - Decoupled

I am working on a single page application using NUXT and Drupal 8 as headless CMS. for user authentication token I am using Simple OAuth Drupal 8 module. Everything is working fine. I am getting the ...
0
votes
0answers
29 views

Decoupled back-end and front-end

I'm looking for the best way to use Drupal as a front-end for a decoupled Drupal back-end. The set-up I'm looking to accomplish is: a Drupal 8/9 back-end as a central content repository 3 Drupal 8/9 ...
2
votes
0answers
109 views

How do you correctly filter on taxonomy terms to get all nodes matching term or parent term?

I have a vocabulary (channel) with two levels. An article node can be added to the first or second level (via field_channel). The hierarchy looks like: channel-1 subchannel-1.1 subchannel-1.2 ...
1
vote
0answers
32 views

How to change <drupal-entity> to HTML

I have a view that returns JSON-serialized content. When there is a link to a file embedded in the content, the response includes the embedded file as tag, rather than regular HTML. My front-end app ...
1
vote
1answer
36 views

Set datetime timezone when posting data via JSON api

I'm using core JSON api to POST/PATCH data from an Android App to my Drupal 8 site. When I need to fill a datetime field I use the next JSON, for example, 2020-02-20T13:15:00. But with this format, ...
1
vote
1answer
38 views

Difference between creating a Rest endpoint and a route&controller with jsonResponse

What is the difference between creating a Rest plugin with the Rest API and creating a route/controller that returns a jsonResponse ? In which case i have to create a custom route/controller with a ...
0
votes
3answers
34 views

403 - node creation via api

I have an issue with creating a node via the API. I have the correct permissions setup but it seems like a glitch somewhere in the permissions. An admin can create a content but no other role can. [...
0
votes
1answer
36 views

Undefined function json_decode()

When attempting to update a Drupal 7 site through the UI or Drush, I get Error: Call to undefined function json_decode() in home/xxxxx/drush/includes/output.inc, line 403 , code: 255) The server is ...
2
votes
1answer
38 views

How to modify jsonapi response?

Hello Drupal community. I have a “Product” content type with field_alert_date field. The field date type is “Date only” so when I get jsonapi response by accessing jsonapi/node/product I have the ...
1
vote
0answers
23 views

Should I use the JSON:API include module or let the front application handle the related entities display?

to get a related entities using the json:api I can use ex: ?include=uid,uid.user_picture in the parameter, and all the related entities will be returned in the included object, then the front ...
2
votes
0answers
33 views

Add extra values to the the document in JSON API Response

I have JSON API with filters. Its working fine. For example: {baseURL}/jsonapi/node/article?filter[X]=Y&sort=title&fields[node--article]=title,drupal_internal__nid At the end of the ...
0
votes
0answers
29 views

Cache Contexts in Entity Definition Doesnt seem to do anything

I have been using jsonapi to query my own custom entity and I've encountered a strange bug: When a user that has access to the entities does a get request at the json:api resource the results get ...
0
votes
0answers
45 views

How to configure feeds module JSONpath mapping, when all information is on the same (root) level?

I would like to import content with feeds module with JSONPath extensible parser and create nodes of them. When I have a hierachical JSON with a parent, the mapping is working like a charme (e.g. ...
0
votes
0answers
13 views

Json for geofield field type

I want to populate a geofield field through Json:api POST request, without success. I've tried some json struct but I didn't find how to do it. These are some attemps I've tried (among others): "...
2
votes
2answers
44 views

Add wrapper to Views Rest JSON Output

I am rebuilding an API in Drupal. The structure of the JSON must remain the same. I am using Views and Draggable Views so the user can order items on an overview page. I Enabled the view for ...
0
votes
1answer
34 views

Using feeds_ex to import content to drupal using 2 steps API calls

I am trying to import data to Drupal 8 website using Feeds and Feeds_ex module and here is my scenario: I need to make a call to the first JSON API and extract the IDs from it, here is a sample of ...
0
votes
1answer
43 views

How to create paragraph of particular type using JSONAPI?

I am able to GET the data using endpoint "site_url/jsonapi/paragraph/text". But I am not able to create a new paragraph of type text. Its always giving me error "403 forbidden". I have tried all ...
0
votes
1answer
76 views

How to provide a filter based on json:api for referencing nodes with a term reference field?

I am working with the Entity Share module to synchronize content between Drupal instances and I need a filter to define which content can be shared. My use case is almost identical to the one ...
1
vote
1answer
64 views

Fetch value from json in mysql drupal 8

I have a field in drupal "field_xyz". it stores json values. JSON looks like this: {"Id_-_SiteWasteProductAction":"34638393224", "Postcode": "CSF 12CF"} I want to fetch postcode value from this json ...
0
votes
0answers
8 views

How to remove duplicate nodes from REST export while applying fallback language

I have created a view using REST export for CT-News. It is formatted as hal_json. It is having filter(Interface translation Lang and English as checked). News is filtered based on the dates(Latest ...
0
votes
0answers
26 views

How to add meta tag to a hook_menu page which return json output?

I have a custom page which I have created using hook_menu $items['list'] = array( 'page callback' => 'page_callback', 'type' => MENU_CALLBACK, 'access arguments' => array('access ...
0
votes
0answers
81 views

Drupal Commerce Post Update Error using Drush updb

Just update drupal and am trying to run drush updb but getting commerce post update errors. Module Update ID Type Description commerce_order 10 post-update ...
1
vote
0answers
92 views

I have troubles creating a node [closed]

I seem to be having troubles creating a node through the JSON API. I am able to get nodes just fine and generate an access token via oauth but I am having no luck creating anything. This is ...
0
votes
0answers
40 views

HTTP exception not giving a Json Response in custom module file

I am using the Drupal REST module. I have a custom module file I have created and it has a hook below function magri_rest_user_presave($account) { if (isset($account->field_region->value)) {...
0
votes
0answers
69 views

How can I update an user field via JSON:API?

How do I update user field via JSON API with D8? EndPoint:https://domainname.com/jsonapi/user/user/ Method:PATCH Request Header; Accept:application/vnd.api+json Content-Type:application/vnd.api+...
3
votes
1answer
132 views

Using OAuth2 on non-REST endpoints

I have a custom module which includes a ControllerBase. The controller has a content() function that returns a JsonResponse(). The code for this function returns a complete list of a certain entity ...
0
votes
0answers
28 views

Destructuring View REST export

I'm having problems destructuring this JSON output, coming from a View REST Export: [ { nid: [ { value: 5 } ], title: [ { value: "...
0
votes
1answer
76 views

Show rendered node in jQuery modal through JSON

Whenever a link has a specific class I want to show it as a jQuery modal. I have added the neccesarry data attributes to the link in order to be able to use it as a modal. I have also created a route ...
0
votes
0answers
593 views

How to create an entity from a custom POST request (JSON:API or REST)?

I've figured out the basics of how to use a simple POST request to create a new Drupal 8 node. For example, using the JSON:API (https://www.drupal.org/docs/8/modules/jsonapi/creating-new-resources-...
0
votes
0answers
52 views

How generate a token for consumer with simple_oauth?

I'm searching how to generate a token with simple_oauth but I'm lost due the installation of our drupal. We're using the Headless Lightning distribution with JSON:API, consumers and simple oauth for a ...
0
votes
0answers
163 views

JSON view (rest export)

I have a rest export view and this is my output: { title: "about", view: "[{"id":7,"field_history_json":7,"field_history_text":"sdfsfsdffd","field_history_year":3244}]" } My field "view" is a ...
0
votes
0answers
19 views

Feed importers: How to import JSON data into a node's field while keeping it formatted as JSON

I'm using Feeds, Feeds Extensible Parsers and the jsonPath Parser to import several thousand items into a D7 site. Each item creates a corresponding Node. The values of most of the JSON key:value ...
0
votes
0answers
19 views

JSONPath Feed Import looks right but not creating nodes?

Using a Feed Importer with the JSONPath parser, I'm stumped as to how I can import the JSON objects as nodes with mapped fields. Here's the JSON that gets returned: [ [ "Label", "...
0
votes
0answers
15 views

How to get array of activeTrail menu id's based on given url

I have a custom module that returns a json output so we can dynamically build the main menu. The issue I've come across is setting the active trail for the current page and the trail up. I am trying ...
0
votes
1answer
48 views

Add paragraphs to a node via jsonapi

Added a paragraph to drupal8 via jsonapi and want this paragraph to be in an articles body. I thought it is as easy as "relationships": { "field_body": { "data": [ ...
0
votes
0answers
30 views

Format Json Responses as Camel Case

Currently our json responses are not formatted at all, we are using the JsonResponse class to return a status code with content: public function getMarkets() { $response = $this->...
0
votes
1answer
500 views

jsonapi Cross-Origin Read Blocking (CORB) blocked cross-origin response in vue

I got the data with postman in json:api at drupal. But I has error of CORB in Vue-resource.get() with code blew: data(){ return{ cyclePic:[], rootUrl:this.$http.options.root, ...
0
votes
1answer
332 views

JSON:API How to retrieve multiple values in a CONTAINS condition?

I'm using JSON:API module (in core since v8.7), and works well for a simple query like: Retrieve all articles with title that contains "MyKeyValue" or subtitle that contains "MyKeyValue" That, ...
0
votes
1answer
31 views

Pagination in external api consume custom module

I created a custom module in order to consume an external api call in my drupal project following this question. The module is working fine, but I need to have a pagination in the received results ...
-2
votes
1answer
169 views

Custom search function with result from external url

I need to create a page in Drupal 8 where there is a text field and a search button. When the user has entered a word to search and hit the search button a list with a search result should be ...
0
votes
0answers
107 views

Subrequests: Assigning Paragraphs entity to node

Migrating a content type from D7 into a greenfield D8 app, so I'm using Subrequests and jsonapi modules. My first subrequest to create a simple Paragraph returns the new ID and it properly replaces my ...
0
votes
1answer
103 views

REST Export Views and images alternative text

I have a simple REST export View. The View format is set to "Show: Entity". The content type I am exporting contains a standard image field. My image field settings is set to "Enable Alt field" and "...

1
2 3 4 5
7