- Fixed a bug where an invalid response code would be returned if the
one
endpoint config setting was used and Craft could not find a matching element. (#157)
- Fixed a bug where endpoint callables weren’t getting called for
OPTIONS
requests. (#156)
- Fixed a bug where custom
cache
durations were getting ignored. (#153)
- Fixed an “Header may not contain more than a single header” error that could occur if a different exception had occurred. (#115)
- Fixed a bug where most exceptions were resulting in 404 responses rather than 500s.
- Fixed a bug where the
cacheKey
setting would cause an error on non-cached endpoints. (#152)
- Added the
cacheKey
endpoint configuration setting. (#145) - Added the
contentType
endpoint configuration setting.
- Element API now requires Craft 3.6 or later.
- API endpoints now send
X-Robots-Tag: none
headers. (#124) OPTIONS
requests now return an empty response. (#128)- JSON Feed endpoints now set the
version
tohttps://jsonfeed.org/version/1.1
. - JSON Feed endpoints now use the
application/feed+json
content type by default. - Error responses no longer contain the exception message, unless the exception thrown was an instance of
yii\base\UserException
. (#130)
- Fixed a bug where API endpoints were returning cached responses for Live Preview requests. (#143)
- Fixed a bug where endpoints whose route params didn’t align with the endpoint arguments would return a misleading 404 message. (#137)
- It’s now possible to invalidate Element API caches via the Caches utility and the
invalidate-tags/element-api
command. (#136)
- Element API now requires Craft CMS 3.5 or later.
- Endpoint responses are now cached by default, and are invalidated automatically when relevant elements are saved or deleted.
- Exceptions thrown while resolving endpoints are now logged. (#117)
- Fixed a bug where non-200 responses were getting cached. (#130)
- Added the
callback
endpoint config setting, which enables JSONP output. (#96)
- The
defaults
setting can now be set to a callable. (#98) criteria
endpoint settings can now specify anoffset
. (#99)- Updated Fractal to 0.18. (#109)
- Deprecated
craft\elementapi\resources\EntryResource
. (#108)
- Fixed a bug where field types that return objects were getting converted to arrays by the default element transformer. Now their serialized value is used instead. (#75)
- The
generateTransformsBeforePageLoad
Craft config setting is now automatically enabled for all Element API endpoints. (#81)
- Fixed a bug where it wasn’t possible to set
cache
,serializer
,jsonOptions
,pretty
,includes
, andexcludes
endpoint config options in thedefaults
array. (#69)
- The cache key now takes into account the current site id. (#76)
- Loosened the Craft CMS version requirement to allow any 3.x version.
- PHP 7.2 compatibility.
- Added support for fetching entry drafts & versions.
- Added
craft\elementapi\resources\EntryResource
.
- Exceptions are now represented as JSON responses, with
error.code
anderror.message
properties. - Renamed
craft\elementapi\ElementResourceAdapter
tocraft\elementapi\resources\ElementResource
. craft\elementapi\resources\ElementResource::getElementQuery()
andgetTransformer()
are now protected methods.
- Fixed a deprecation error that occurred on Craft 3 Beta 25 and later. (craftcms/cms#1983)
- Craft 3 Beta 24 compatibility.
{note} You will need to rename your Element API config file to
element-api.php
when updating to Craft 3 Beta 20+ and Element API 2.4.1+.
- Craft 3 Beta 20 compatibility.
- Added the
include
andexclude
endpoint config settings. (#42)
- Added the
cache
endpoint config setting.
- Added a JSON Feed V1 serializer.
- Added the
meta
endpoint config setting. - Added the
serializer
endpoint config setting. - Added the
jsonOptions
endpoint config setting. - Added the
pretty
endpoint config setting.
- Updated Fractal to 0.16.
- Fixed a bug where pagination URLs contained an extra
pattern
query param.
- Added support for a
resourceKey
endpoint config setting (default is'data'
).
- Fixed the changelog and download URLs.
- Fixed a PHP error that occurred when paginating results. (#36)
- Craft 3 Beta 8 compatibility.
- Craft 3 compatibility.
- It’s now possible to provide custom resource adapter classes, which could be associated with other things besides elements.
- Added
craft\elementapi\ResourceAdapterInterface
. - Added
craft\elementapi\ElementResourceAdapter
.
- Deprecated the
first
endpoint config setting. Useone
instead.
- Added the
include
andexclude
endpoint config settings. (#41)
- Added the
cache
endpoint config setting.
- Fixed a bug where endpoint were sending JSON headers even if an exception occurred and the HTML error view was returned. (#39)
- Added a JSON Feed V1 serializer.
- Added the
meta
endpoint config setting. - Added the
serializer
endpoint config setting. - Added the
jsonOptions
endpoint config setting.
- Updated Fractal to 0.16.
- Added support for a
resourceKey
endpoint config setting (default is'data'
).
- Pagination URLs will now honor any existing query string parameters.
- Added the
elementApi.onBeforeSendData
event.
- Updated to take advantage of new Craft 2.5 plugin features.
Initial release.