Questions tagged [plugin-elementapi]
Plugin that makes it easy to create a JSON API for your elements, from Pixel & Tonic.
228 questions
2
votes
1
answer
187
views
How to Escape a Query Parameter
Extremely not a PHP developer here but trying to set up a simple API with Element API. I've got the basics working to filter my entry results based off of a query URL parameter:
use craft\elements\...
1
vote
1
answer
106
views
How to migrate a selection of users passwords from a Craft 3 to a separate Craft 4?
I'm trying to move a large batch of users from a Craft 3 to a separate Craft 4 websites (only some selected data should be migrated).
Element API + FeedMe looks like the right solution for that, as ...
0
votes
1
answer
82
views
Element-api get other entries by id inside a entry.json
I have few entry ids from a plugin(donkeytail), and are arranged in an array,
I need to loop through that array and get title, slug, etc of each entry.
$entry->pins = ["106","122&...
0
votes
0
answers
67
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 ...
0
votes
0
answers
100
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 = [
'...
1
vote
1
answer
86
views
Jsondecode in element API causing memory issue
I have the element api pulling back 1300 entries. One of the fields is storing geojson data and I had to change the type from text to mediumtext to accommodate some of the data stored.
When I moved ...
1
vote
0
answers
143
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 ...
1
vote
0
answers
127
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 ...
1
vote
1
answer
1k
views
Element API: Get Entries Related to Category with Query Parameter
I'm using the Element API Plugin to create an API, with which I want to get entries related to one category, but dynamically with the category set in the Url.
What I have so far in the config/element-...
2
votes
1
answer
215
views
Element API using the entries field to display related content from a separate section
I've seen similar questions but none seem to help.
I have two sections named jobs and jobDescriptions. I'm using the entries field to pull in a description field from the jobDescriptions section to ...
1
vote
2
answers
209
views
Accessing SEOmatic meta via controller action in Element API triggers HTTPForbiddenException
I'm attempting to fetch SEO meta for entries inside of an element API, roughly following the advice in Element API integration
Below is the exact code in my element-api.php:
<?php
use craft\...
2
votes
2
answers
585
views
How to search on multiple (custom) fields using Element API
I am using the Element API to search for entries that match a search query: either the title OR the excerpt should contain the query term. The entry is very simple and has these fields:
-title
-...
1
vote
1
answer
435
views
Element API, query entries where relationship field ':empty:' AND the same relationship field with specified entry ID
Element API, query entries where relationship field ':empty:' AND the same relationship field with specified entry ID.
Can't seem to figure out how to do this without performing two separate queries ...
1
vote
1
answer
74
views
Setting relative path to ElementAPI in PHP
I need a few small bits of data from Craft in a PHP file. It’s a really small task, so I don’t want to delve into writing plugins or anything hardcore.
It seemed to me the simplest way to approach it ...
2
votes
1
answer
326
views
Get currentSite.handle in Element API
I need to get the currentSite in Element API. How can this be achieved? Is it as a slug in the endpoint URL? or as a Query param? Here is the current code:
<?php
use craft\elements\Entry;
use ...