Version 3.0.1.1

July 7, 2022

Fixed

  • Fixed changelog.

Version 3.0.1

July 7, 2022

Fixed

  • Fixed an issue where EVENT_BEFORE_SEND_DATA wasn't returning data. (#165)

Version 3.0.0

May 3, 2022

Added

  • Added Craft 4 compatibility.

Removed

  • Removed craft\elementapi\resources\EntryResource. (#108)

Version 2.8.5

May 3, 2022

Fixed

  • Fixed an error that occurred on Live Preview requests, for endpoints with a cache key defined. (#158)

Version 2.8.4

December 15, 2021

Fixed

  • 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)

Version 2.8.3

September 25, 2021

Fixed

  • Fixed a bug where endpoint callables weren’t getting called for OPTIONS requests. (#156)

Version 2.8.2

September 3, 2021

Fixed

  • Fixed a bug where custom cache durations were getting ignored. (#153)

Version 2.8.1

September 1, 2021

Fixed

  • 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)

Version 2.8.0

August 31, 2021

Added

  • Added the cacheKey endpoint configuration setting. (#145)
  • Added the contentType endpoint configuration setting.

Changed

  • 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 to https://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

  • 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)

Version 2.7.0

May 26, 2021

Added

  • It’s now possible to invalidate Element API caches via the Caches utility and the invalidate-tags/element-api command. (#136)

Changed

  • 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

  • Fixed a bug where non-200 responses were getting cached. (#130)

Version 2.6.0

August 1, 2019

Added

  • Added the callback endpoint config setting, which enables JSONP output. (#96)

Changed

  • The defaults setting can now be set to a callable. (#98)
  • criteria endpoint settings can now specify an offset. (#99)
  • Updated Fractal to 0.18. (#109)

Deprecated

  • Deprecated craft\elementapi\resources\EntryResource. (#108)

Fixed

  • 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)

Version 2.5.4

July 29, 2018

Changed

  • The generateTransformsBeforePageLoad Craft config setting is now automatically enabled for all Element API endpoints. (#81)

Fixed

  • Fixed a bug where it wasn’t possible to set cache, serializer, jsonOptions, pretty, includes, and excludes endpoint config options in the defaults array. (#69)

Version 2.5.3

June 20, 2018

Changed

  • The cache key now takes into account the current site id. (#76)

Version 2.5.1

November 9, 2017

Changed

  • PHP 7.2 compatibility.

Version 2.5.0

October 31, 2017

Added

  • Added support for fetching entry drafts & versions.
  • Added craft\elementapi\resources\EntryResource.

Changed

  • Exceptions are now represented as JSON responses, with error.code and error.message properties.
  • Renamed craft\elementapi\ElementResourceAdapter to craft\elementapi\resources\ElementResource.
  • craft\elementapi\resources\ElementResource::getElementQuery() and getTransformer() are now protected methods.

Version 2.4.3

September 14, 2017

Fixed

  • Fixed a deprecation error that occurred on Craft 3 Beta 25 and later. (craftcms/cms#1983)

Version 2.4.2

August 17, 2017

Changed

  • Craft 3 Beta 24 compatibility.

Version 2.4.1

July 7, 2017

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+.

Changed

  • Craft 3 Beta 20 compatibility.

Version 2.4.0

May 25, 2017

Added

  • Added the include and exclude endpoint config settings. (#42)

Version 2.3.0

May 24, 2017

Added

  • Added the cache endpoint config setting.

Version 2.2.0

May 18, 2017

Added

  • 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.

Changed

  • Updated Fractal to 0.16.

Fixed

  • Fixed a bug where pagination URLs contained an extra pattern query param.

Version 2.1.0

May 16, 2017

Added

  • Added support for a resourceKey endpoint config setting (default is 'data').

Fixed

  • Fixed the changelog and download URLs.

Version 2.0.2

April 18, 2017

Fixed

  • Fixed a PHP error that occurred when paginating results. (#36)

Version 2.0.1

March 24, 2017

Changed

  • Craft 3 Beta 8 compatibility.

Version 2.0.0

February 10, 2017

Added

  • 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

  • Deprecated the first endpoint config setting. Use one instead.

Version 1.6.0

May 25, 2017

Added

  • Added the include and exclude endpoint config settings. (#41)

Version 1.5.0

May 24, 2017

Added

  • Added the cache endpoint config setting.

Fixed

  • Fixed a bug where endpoint were sending JSON headers even if an exception occurred and the HTML error view was returned. (#39)

Version 1.4.0

May 18, 2017

Added

  • Added a JSON Feed V1 serializer.
  • Added the meta endpoint config setting.
  • Added the serializer endpoint config setting.
  • Added the jsonOptions endpoint config setting.

Changed

  • Updated Fractal to 0.16.

Version 1.3.0

May 16, 2017

Added

  • Added support for a resourceKey endpoint config setting (default is 'data').

Version 1.2.1

April 12, 2016

Changed

  • Pagination URLs will now honor any existing query string parameters.

Version 1.2.0

April 2, 2016

Added

  • Added the elementApi.onBeforeSendData event.

Version 1.1.0

December 20, 2015

Changed

  • Updated to take advantage of new Craft 2.5 plugin features.

Version 1.0.0

August 19, 2015

Initial release.