Questions tagged [json]

The tag has no usage guidance.

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

json:api endpoint simplification

the JSON:API endpoint is getting too long so is there any way to simplify the URL ex: instead of : /jsonapi/node/article/55d611ab-5752-469h-bf44-648c8cud2a9f?include=field_composants,field_composants....
1
vote
0answers
47 views

Retrieving a field in a paragraph with JSON:API

I have a "user_group" paragraph type which has a user node reference field called "field_group". Then each user has a paragraph reference field called "field_groups". So, ...
0
votes
0answers
15 views

Custom JSON api normalizer is not initiated

I am trying to figure out how to make a custom normalizer for an entity work. I've added the normalizer to my services.yml with the required tag and arguments and run into no errors. But when ...
0
votes
0answers
15 views

How to include paragraph image url in node/page call

i dont know how to include the url of image used in my paragraphs with JSON API. Ex of request : https://domain.tld/jsonapi/node/cms_page/{uuid}/?include=field_contenu_page { "included&...
0
votes
2answers
42 views

Alter Services JSON Response

I have created a view to render all taxonomy terms and displayed it through a service. I have also created an endpoint in the service module to hit the url through firefox add-on RESTer to test the ...
1
vote
1answer
72 views

Pretty-printing JSON as preformatted text in translatable string passed as argument to method?

LENGTHY PREAMBLE: In a Service class, I'd like to display onscreen debug info for users with a specific permission. In my_custom_module.permissions.yml: 'view debug info': title: 'View debug info' ...
0
votes
0answers
19 views

Saving JSON to user field

I have a user field that'll be used to save some user-specific JSON. I have ajax that uses a token with a route to get to a controller to save some JSON to the field. I basically have this: public ...
0
votes
0answers
26 views

Can't update profiles with REST API

how is the body json format for update (PATCH) one profile via REST api in Drupal 8? and the endpoint? i can create one profile correctly follow this instructions , but for update? What json body ...
0
votes
0answers
23 views

Export current gutenberg content for page entered in the visual editor as JSON

I'm using Gutenberg and various custom content types like blog post, person, article, etc. I want it so when a user creates an article it automatically fills the page with a preset set of blocks with ...
0
votes
1answer
44 views

Exception handling for incorrect content type for request in custom REST API plugin

I have created a custom REST API plugin for an endpoint. I have set the accepted format to json using the configuration options. This works. However, if we set the content-type to something other than ...
0
votes
0answers
36 views

Making authenticated service call with dart (flutter)

I am attempting to make an authenticated call to Drupal 7 using services 3.7 in dart (Flutter framework) I can retrieve a token and login but when I make a call to; [ENDPOINT]/user/[USER_ID] I get ...
0
votes
1answer
16 views

Dynamically add destination fields to migration - importing data when fields on destination entity are not know

I am trying to import content from JSON from an API call. This API call has different source data depending on what the call is. For my migration from this JSON, there are set fields that I have coded ...
0
votes
1answer
29 views

How to add a translation to an existing node/entity using REST?

I have a headless Drupal 8 and want to create a translation for an existing NODE using a POST request but cannot figure how to. I know how to create, edit and delete a node but am unsure on how to add ...
0
votes
1answer
23 views

Create nodes from a JSON file uploaded in a form by an user

I've got this form: $form['import_json'] = [ '#type' => 'file', '#description' => $this->t('Allowed extensions: json'), '#title' => $this->t('Import your JSON\'s ...
0
votes
1answer
74 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
33 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
43 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
26 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
73 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
33 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
35 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
16 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
1answer
60 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
32 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
165 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
51 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
40 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
37 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
61 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
49 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
26 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
39 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
34 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
55 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
69 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
60 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
48 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
129 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
111 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
27 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 ...
1
vote
0answers
93 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
42 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
1answer
105 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
180 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
1answer
93 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
204 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
1answer
56 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
32 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->...

1
2 3 4 5
7