Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [json]

The tag has no usage guidance.

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

How do I take my custom view and pass it through a json object to a template which prints out the title? [on hold]

I want to write a custom module that: Gets the node title that is printed out by a custom view and then passes it inside a json object to a template which prints out the title. e.g: http://my-drupal-...
0
votes
1answer
34 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
14 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 ...
0
votes
0answers
23 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 ...
1
vote
1answer
34 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
7 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
25 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
27 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
71 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
32 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
32 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
85 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
23 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
58 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
1answer
159 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
21 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
76 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
17 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
18 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
13 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
38 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
27 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
262 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
188 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
21 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
86 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
66 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
47 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
vote
0answers
25 views

Migrate Update already imported content from the Json source

I have two JSON source files of product categories which contain duplicate products. Here's the link of the two source JSON files https://gist.github.com/naveenvalecha/...
0
votes
0answers
24 views

Comment API Endpoint for restful module drupal 7 not working

I am trying to put comment to a node using POST method to the endpoint api/v1.1/comments Here is the API file: <?php /** * @file * Contains \Drupal\restful_example\Plugin\resource\comment\...
1
vote
0answers
216 views

How to serialize a form's render array to JSON

I want to build a REST resource to return Forms as JSON with all labels, help text, default values, etc... When I use REST's built-in resource /entity/entity_form_display/node.article.default it does ...
0
votes
0answers
193 views

Post http request with raw json?

I need to build a http_request raw json in drupal 7 and the format of the json is: {"customerAddress": { "address":"foo st", "town":"Roma", "postalCode":"00131", "...
0
votes
1answer
28 views

push jsonlog data to elasticsearch

I have installed the module jsonlog on drupal 7, but there are no information on how can I push the logs to elasticsearch or kibana or logstash. How do I do that?
1
vote
1answer
217 views

Paragraphs from sub_process

I need to migrate a json feed with following example structure; { "data":[ { "id":"11028", "first_name":"Foo", "last_name":"Bar", "functions":{ ...
0
votes
0answers
36 views

Tempstore UUID goes to 404 page

I am using JSON API. For the Preview, for the newly created Article storing UUID in tempstore. http://127.0.0.1/project/jsonapi/node/article/f0c7fa28-5289-49b7-9c90-94c81d198d87 But when I run it ...
0
votes
1answer
238 views

Paragraphs module decoupled structure

I'm looking to use the Paragraphs Drupal 8 module with a decoupled installation of Drupal 8 but would like the structure made in the admin area to be output in the JSON API responses. How can I ...
2
votes
1answer
192 views

How to change view REST export format

This is my settings in view. Data what I have is now in this format: [{"created":"1551709414","field_iot_integer":"43"}, {"created":"1551709404","field_iot_integer":"98"}, {"created":"1551709392","...
1
vote
1answer
74 views

json migration to nodes

I have a json file with 572 items. I have created the migration script and it runs ok, except that the end results says processed 572 items (1 created, 571 updated) It looks like instead of ...
0
votes
1answer
37 views

Serializing dates

In Drupal, we have the time printed as "2012-03-19 07:22". What I need is just "\/Date(1198908717056)\/" or just "1198908717056". I am trying to get that format using the following code. use Drupal\...
1
vote
0answers
430 views

“Not acceptable format” error on JSON login

I am testing the REST API, with the REST UI module installed on Drupal version 8.6.9. In Postman, using the POST method (http://www.domain.com/user/login?_format=json), I get the following error. ...
0
votes
1answer
711 views

User login through JSON request returning HTML instead of JSON

I am using Drupal 8.6.4 http://example.org/user/login?_format=json When I try to submit a post request, it returns HTML page instead of JSON response. I am sending headers: Content-Type: ...
0
votes
0answers
11 views

How to consume Views GeoJSON in a custom JS map application?

I'm trying to implement a custom Google Maps implementation that uses data from Views GeoJSON feeds. I need a custom approach as I need to be able to add multiple data layers. So, I need to grab the ...
1
vote
1answer
85 views

How to make use of the render placeholder system for cacheablejsonresponse?

I have custom controllers which provide CacheableJsonResponse responses. Those responses are quite heavy to build (couple of seconds), so I want to build them better. I build those responses by ...
0
votes
0answers
249 views

My custom normalizer doesn't get executed

I'm building a REST api with Drupal 8 and I want to override the normalizer for the Formated Text field type. I started with this example module: https://github.com/jazzdrive3/example_normalizer ...
0
votes
0answers
127 views

Formatting Paragraphs in json in my drupal powered REST API

I'm using Paragraphs to organise my content. A Project has many paragraphs. Each paragraph can be of type Text or Image (thanks to the paragraph type feature). I want to expose my content to a REST ...
0
votes
0answers
40 views

How to store non-entity data using REST?

I'm developing a decoupled system where the end user can add additional textual information to images displayed by Drupal 8 in a lightbox. When the user opens an image, my custom module launches a ...
0
votes
1answer
34 views

Using JSON:API to replicate content on external location

I would like to create content on another Drupal instance using JSON:API. Using the jsonapi_extras service, serializer.normalizer.entity.jsonapi_extras, entities can serialized but contain more node ...
-1
votes
1answer
82 views

Alter serialized json output

Everytime a node is created, I have a Rules Action that serialized the data into json and send it to OneSignal. I have the below code that does it... $entity_id = $entity->id(); // Getting ...
2
votes
2answers
829 views

How can I fetch the complete main navigation menu via JSON:API?

How can I fetch the complete main navigation menu via jsonapi? I've tried: curl --header 'Accept: application/vnd.api+json' https://cms.example.com/jsonapi/menu/menu/ and curl --header 'Accept: ...
0
votes
0answers
13 views

Define permissions per resource

I'm using jsonapi for a headless approach, and need to return a 403 for certain resources if they don't have the permission to view them. Currently this isn't possible using the module - instead the ...