.. include:: ../Includes.txt .. _annotations_custom: ============ Custom Annotations ============ Adding custom annotations to your TYPO3 RestApi endpoints --------- If you would like to add custom annotations that get parsed and passed to the `endpoint`, then follow these steps. .. rst-class:: bignums 1. Create a class for the annotation Create a file in your own extension under ``Classes/Annotations/Example.php``. **Important:** The class needs to have the ``@Annotation`` in the class comment. .. code-block:: php value = is_array( $arr['value'] ) ? $arr['value'] : [$arr['value']]; } /** * This method is called when parsing all classes. * You must implement it in your own Annotation, if you want the parsed * data to be cached and accessible later in your endpoint. * */ public function mergeDataForEndpoint( &$data ) { $data['myIdentifer'] = $this->value; } } 2. Use the annotation in your endpoint Make sure to reference your namespace. .. code-block:: php request->getEndpoint(); \nn\t3::debug( $endpoint ); die(); } } 3. Access the annotation value You have access to the value of your annotation at several places. Here is an example that accesses the above annotation value in the ``checkAccess`` method: See :ref:`@Api\\Access(...)` for details. .. code-block:: php