Skip to main content

Questions tagged [plugin-elementapi]

Plugin that makes it easy to create a JSON API for your elements, from Pixel & Tonic.

32 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
0 answers
872 views

How to handle Craft 3 events in a plugin? Element API is returning null data

The below refers to Craft 3 and the Element API plugin for Craft 3. I would like to do something when the Element API plugin fires its onBeforeSendData event, I can see in the controller for element ...
Paul Blundell's user avatar
3 votes
0 answers
296 views

Getting related entries along with entry using the Element API plugin

I want to list all the related entries to the entry I am displaying using the Element API plugin. I have a channel called series and another called episodes, the episodes have a relationship with 1 ...
zizther's user avatar
  • 449
3 votes
0 answers
510 views

How can I use the ElementAPI to get related entries based on two parameters?

I can successfully get entries related the "normal" way, but my list of possible results are getting quite large. Currently I am returning html mixed in with the data. It's obvious I need to get just ...
Damon's user avatar
  • 4,706
2 votes
0 answers
450 views

Group by Date Field in Element API Query

I have a custom field called releaseDate in one of my entry types. I would like to use Element API to get all the distinct years assigned to those entries. I dump all the years for all entries just ...
Tony DeStefano's user avatar
2 votes
0 answers
257 views

Get field type of product or variant with element api

Trying to get type of a field (dropdown, checkbox, etc) to render those fields in app, there is all sorts of info available in $variant->fieldLayout->fields like handles, values, ids except type ...
Alex's user avatar
  • 31
2 votes
0 answers
788 views

Ordering Element API by Category and Title

I'm looking for a way to order the ElementAPI json array by category and title. I can only get one to work whether it's 'group' => 'stockistRegion.first().title' or 'order' => 'title' using the ...
Jack Stenson's user avatar
1 vote
0 answers
118 views

Element API relatedTo not working

I'm creating a lazy load/infinite scroll based on the tutorial but I want it to grab entries that are in categories. It doesn't seem to be doing anything with it at all though. It's returning the list ...
Alyssa Tyler's user avatar
1 vote
0 answers
97 views

Join multiple tables in element-api

My problem is the following: I have a website with products which contains ratings. I have an element-api endpoint to get the products. I want to sort the products based on the average rating or the ...
Mathies Gielen's user avatar
1 vote
0 answers
126 views

Migrating to Matrix using Feed Me and Element API

How can I use Element API to move my entry fields into a matrix-based content builder? I'm going off the docs found at https://docs.craftcms.com/feed-me/v4/guides/importing-into-matrix.html#setup-your-...
Christopher Kennedy-Nuñez's user avatar
1 vote
0 answers
368 views

How to get an Entry in structure and all of its children and it's children's children with Element APi?

How do I get all of an entry's children using the Element API? I want to return something like: data: [ title: 'Root Entry' uri: 'root-entry' children: [ { title: '...
kayq's user avatar
  • 77
1 vote
0 answers
27 views

Locales with independent language and country

How might we use Craft to manage our locales, keeping our language and country logic independent? The desired scenario: No duplicate language entries: Spanish in Spain would be the same as Spanish in ...
Sean O'Brien's user avatar
1 vote
0 answers
42 views

Query element api (output) via plugin

Is there a way to fetch the content generated by the Element API via a plugin. For example, if we have created an ingredients/<slug:{slug}>.json endpoint, can the data for a specific page (eg ...
Cole Henley's user avatar
  • 1,741
1 vote
0 answers
203 views

element-api: include a collection with mixed entry types, and nested includes

Does anyone know how to include a collection of entries, containing multiple entry-type, in such way that: 1. Each entry type gets transformed by its own custom transformer class (tailord to the ...
yoannisj's user avatar
  • 111
1 vote
0 answers
60 views

Retrieving Entries by Category & Exclude by Tag

I have an endpoint that I want to retrieve entries by a category, but then exclude entry ids if they have a certain tag. It seems to me that the relatedTo param overrides the id param that says not in ...
Michael's user avatar
  • 33
1 vote
0 answers
587 views

Element API SearchQuery to search for value inside child-entries

I currently try to use the Element API to build a search. Unfortunately I'm kind of stuck. I have a baseEntry, that has a field that references entries (let's call them subEntries) of the section ...
Eternal Black's user avatar
1 vote
0 answers
106 views

Check the field type of all the attributes of an entry

Here's the whole picture: I'm trying to make an API endpoint which should output everything from an entry: First I did this: public function transform(Entry $entry) { return $entry-...
Jorge Anzola's user avatar
1 vote
0 answers
516 views

Element API plugin: searching and working with nested objects

I’m experimenting with the Element API plugin and working with querying the tags of the assets that appear in matrix blocks in a set of entries. Essentially I’m hoping to be able to use a tag in a ...
Evan's user avatar
  • 11
1 vote
0 answers
189 views

Craft 3 Element Api when system status is disabled

Using Craft 3 RC14 System status is set to off Wondering if anyone has approached the same problem as I did. If there is a way to use element api while the system status is disabled? I have tried ...
Jarek's user avatar
  • 11
1 vote
0 answers
439 views

What are my caching options when using CraftQL and React?

I’m experimenting with the CraftQL plugin and React with Craft 3, and I’m really liking the similar syntax to standard Twig element queries, and the fact I don't need to manually configure API ...
Alex H's user avatar
  • 955
1 vote
0 answers
150 views

Using target element criteria to filter results

I'm using the Element API plugin to try and search for addresses using minimum and maximum lat & lng values and then using target element within the criteria parameters to filter the results ...
user311's user avatar
  • 21
1 vote
0 answers
831 views

How to get list of category groups?

Is it possible to get a list of category groups without having to loop through all categories to get their parent group name? UPDATE: Just making this question clearer, as it's related to using ...
samput's user avatar
  • 51
1 vote
0 answers
413 views

Using element API to query a matrix field

I'm using the Element API to grab entries and their data (via this answer). What I want to do is accept a URL parameter (eg. ?location=foo) and filter the returned entries by a Matrix field called ...
Matt Andrews's user avatar
1 vote
0 answers
253 views

Craft CMS Integration with Node

Question 1 I have a Node/Express application where the users are registered and are using some kind of service. I want to have a list of the registered users and their info inside Craft CMS admin ...
Radoslav Julic's user avatar
1 vote
0 answers
135 views

How can i request image locations through elements api for an entry in section?

i have endpoint: 'news/<slug:{slug}>.json' i print out EntryModel-Class in transformer function and it doesn´t seem to contain any photos like how it is described in Element Api example loop at ...
goran's user avatar
  • 123
0 votes
0 answers
43 views

Element API: Group Categories by Groups

I want to use the Element API to output a hierarchical JSON list of categories grouped by category group. For example: { "groups": [ { "id": 2, &...
kmgdev's user avatar
  • 1,199
0 votes
0 answers
38 views

Outputting geojson collection with element-api

I am trying to get the element-api to output a valid geojson collection. The way the keys are set in the returned data make me think it isnt possible. To produce a valid string of json i am having ...
joomkit's user avatar
  • 2,034
0 votes
0 answers
83 views

Element-api search with space in query returns zero data

I have an endpoint for searching entries via the element api. 'api/searchtherest.json' => function () { $section_handle = 'openFunding'; $criteria = [ '...
joomkit's user avatar
  • 2,034
0 votes
0 answers
197 views

How to load more entries of a category on that category's page with Element API?

Following up on previous questions of mine: How to use multiple different instances Element API "Load More" button? I have a website that utilizes the "load More" (button) method ...
Justin Kendall's user avatar
0 votes
0 answers
236 views

Search for category and title in Element API for Jquery Autocomplete

I'm working on the search Autocomplete based on this article, http://craftsnippets.com/articles/search-autocomplete-component-for-craft-cms Besides the title, I want to search within the category too....
Lee's user avatar
  • 139
0 votes
0 answers
319 views

Deprecation Warning: Use the all() function to fetch the query... in PHP

I am getting this warning message: "Looping through element queries directly has been deprecated. Use the all() function to fetch the query results before looping over them. " It is pointing out ...
Jessica Talzor's user avatar
0 votes
0 answers
79 views

ElementAPI: How to trigger the Custom service php file when a endpoint is loaded

I am Using Craft 3.3.11 version I have a php file in plugin/elementapi/src/services/EapiServices.php and the same file within vendor/craftcms/element-api/src/services/EapiServices.php When ...
Velan's user avatar
  • 1
0 votes
0 answers
169 views

Using Embedded Assets Plugin With Element API

When using the Element API, how do you go about using the Embedded Assets plugin? With a regular asset, in the API transformer you can pull out assets and include them like this: 'transformer' => ...
JamesNZ's user avatar
  • 947