Questions tagged [json]
The json tag has no usage guidance.
138
questions with no upvoted or accepted answers
6
votes
1answer
1k views
Change views exposed filter format
I am build a JSON export using a View in Drupal 8. Problem is that the parameters for retrieving the json doesn't seem to work as I would want.
In my View I need use two exposed filter criteria to ...
3
votes
1answer
201 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 ...
3
votes
0answers
129 views
How to add new data to field that support multiple field via JSONAPI?
I am using jsonapi to PATCH(update) a content in a content type called "engagement". All the APIs including patch are working fine. However, when I am trying to update a new value to a field with ...
3
votes
1answer
907 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 ...
3
votes
0answers
62 views
How do I get back JSON value using entityform?
I am using drupal 7 entityform in this case, as i want CRUD functionality with the form. Can anyone tell me how should i configure my services.
As of now i have configured it manually, selected the ...
3
votes
1answer
499 views
drupal_http_request returning Invalid JSON primitive:
I am developing a module for Drupal 7 that has t make a call to a remote API. I am using drupal_http_build_query and drupal_http_request and finally drupal_json_decode to decode the output.
My code ...
3
votes
2answers
537 views
Strip HTML tags from Field Collections in Services Views
I'm trying to strip the HTML tags from a JSON response I generated using Services Views, but I'm not having any luck so far.
I have a content type with a Field Collections field in it that is ...
3
votes
1answer
434 views
Templating JSON
Is there a Drupal way to template the results of ajax query that returns JSON. The JSON is is being returned to some php module code. If there is not a Drupal way I was thinking of using something ...
2
votes
0answers
184 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
...
2
votes
0answers
49 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 ...
2
votes
1answer
900 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. ...
2
votes
0answers
150 views
Field Collection RESTful API rendered in HTML
I'm not sure this is a bug or what. But when I create API view page and add field (which is field collection), it rendered HTML instead of 'neat' JSON.
For example it should be look like :
...
2
votes
1answer
534 views
How can I return literal JSON from a node as a JSON object in views json?
I have a content type with a field called output. This field will contain JSON. I want to output this field as JSON using Views JSON (in Views Datasource). The problem I'm encountering is views ...
2
votes
1answer
799 views
JSON format for creating users with custom fields using services
I am using Services module to register new users. My registration form has some custom fields like text field, radio buttons and select list. The following is the data I am sending:
{
"name" : "...
2
votes
1answer
445 views
Migrate : Update not working
Im using the migrate module to import data from a json feed.
Mostly work fine however, i require that each time the feed is imported , updated records in the source are updated in the destination if ...
2
votes
0answers
112 views
Search a URL list, return JSON values into a dynamically generated table
I am looking for a Drupal Service or a Module (or a link to a working example) of this arrangement:
There's a Search form. Placing and submitting the search will make a REST call for certain values ...
2
votes
0answers
1k views
500 Internal Server Error Services REST JSON Content
I am retrieving JSON from my Drupal Site to show content on an external Device. I am using Drupanium/REST/Services to do so.
Now the problem is weird.
When I try to access this URL, it works fine:-
...
2
votes
0answers
647 views
How to speed up json views in drupal 7
I am trying to get json response from my drupal7 site using Views.
Example : www.mysite.com/company company refers to a view which was created using json document
I also applied caching to the ...
2
votes
0answers
905 views
Produce JSON output from taxonomy tree
I am trying to return a taxonomy tree in the JSON format but the issue is that I would like to have it nested based on the depth of the term, like the following format:
What is the easiest way to do ...
1
vote
0answers
24 views
Convert User object to same JSON Structure as D7's
We are migrating a D7 site to D8 and I have an API endpoint that returns the current user that I need to migrate. In D7, I would do something like:
global $user;
$u = user_load($user->uid);
return ...
1
vote
0answers
53 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, ...
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
41 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 ...
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 ...
1
vote
0answers
27 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/...
1
vote
0answers
295 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 ...
1
vote
1answer
94 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 ...
1
vote
1answer
83 views
Migration configuration
I'm setting up a migration from an URL with JSON on it.
Got the first level values without any issues. Currently I'm stuck at nested arrays which resemble something like this:
{ "content": [
{
...
1
vote
1answer
1k 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
vote
0answers
432 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 ...
1
vote
0answers
67 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 ...
1
vote
0answers
504 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 ...
1
vote
0answers
304 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 ...
1
vote
0answers
45 views
Posting Data to an external site using APIs
I've been tasked with posting information from our website to recreation.gov, using their API http://usda.github.io/RIDB/
Is there a specific way using any sort of drupal module or built in PHP with ...
1
vote
0answers
158 views
Exporting data from VIEWS in JSON
I am using the modules Views data export and Views data export - JSON support to display data from View in the JSON file.
I am currently using 2 different terms in 1 View for example: View name "...
1
vote
0answers
270 views
How to store data in multiple “field collection table” fields
I'm having problem while storing data in multiple field collection table fields, Here I have tried following JSON format of drupal 7 services.
"field_grp_travel_time": {"und":[ {"value":"1.5"}, {"...
1
vote
0answers
143 views
Drupalgap android app using quiz module
I am trying to create a Drupal 7 quiz site of multiple choice questions. The users should be able to attempt quiz on the desktop site and as well as on an android app developed using Drupalgap module. ...
1
vote
0answers
119 views
Update node via external API JSON
I've got a custom content type "Publications" with custom fields. Two of these fields are:
DOI (document object identifier), a unique identifier for the publication
Altmetrics, the total "online ...
1
vote
0answers
14 views
Create content of certain content type based on outside information/validation
I'm running a game server. This server is updated ever so often and I want my players to be informed about the update.
I want this to happen automatically. What I have is some JSON output I can query ...
1
vote
0answers
34 views
inserting a date into database with JSONParser module
i have a json file
{
"student":[{"firstname":"bharath","marks":"80","dateone":"13/09/2014 06:07:08","datetwo":"18/12/2016 09:08:05"},
{"firstname":"purna","marks":"70","dateone":"17/03/2012 ...
1
vote
1answer
170 views
Can't save location when posting node through services module
I am using services module to post nodes using rest/json. The nodes also contain images and location. So far I can upload the image and save the node, but the location is not saved. I receive no ...
1
vote
0answers
39 views
How to include an image in the user registration using the module Services
As the scheme would be to post a picture in the picture user or field in another field custom image. I tested with the following scheme and get nothing. The other fields in the record, user, password, ...
1
vote
0answers
200 views
Field Collection values in json data document view
I am wondering if I am hitting the limits of what can be done with the json data document view for displaying output and whether I need to just write my own module or use php's json_encode to do this.
...
1
vote
1answer
22 views
How to fetch all the details of a marketplace organization's page on Drupal.org
I am new to Drupal.
I am trying to fetch all the details of a marketplace organisation's page, which are visible on drupal.org.
I am using the node id to access "https://www.drupal.org/api-d7/node/...
1
vote
2answers
112 views
Is it safe to send the unencoded JSON output?
The mobile app developers wants an api to get a list of articles from our Drupal site.
It should have these fields in the output:
nid
title
field_teaser_body
The api resonse has to be in JSON format....
1
vote
1answer
54 views
JSON Menu Link Without Invoking Init Hooks?
Our Drupal site utilizes a number of menu hooks to return JSON from an API we manage in a separate Web API. We also have a number of intensive tasks that happen on each page load via the hooks_init in ...
1
vote
1answer
684 views
POST JSON data denormalization error
I created rest resource plugin in a custom module and need to send some JSON data with the request, and access it in the post function. At the moment my post function does not do anything but return ...
1
vote
0answers
387 views
REST export doesn't give image URLs
We have a headless Drupal 7 project that uses express and handlebars for it's front end. I'm experimenting with updating the backend to use Drupal 8.
I've created a REST export type view, but when ...
1
vote
0answers
37 views
How to run auto feed with a auto link for every created node?
I'm stuck on changing the url of a feeds
what i want to do is after a person creates a content
that feeds runs his feeds to the target url depending on
the value he filled in.
example:
person fills ...
1
vote
1answer
535 views
Integrating external web application
I have an existing web application written in Flask. I want to create a Drupal site that integrates this existing web application, so that the existing webapp will just be a back end, and the Drupal ...