# Extending API -- Config + Controller namespace issues?

**URL:** <https://forum.mautic.org/t/extending-api-config-controller-namespace-issues/18354>\
**Category:** Product Support\
**Created:** [February 27, 2021, 7:48pm UTC](https://forum.mautic.org/t/extending-api-config-controller-namespace-issues/18354 "2021-02-27T19:48:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nacmonad](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/nacmonad/32/441_2.png) [@nacmonad](https://forum.mautic.org/u/nacmonad)\
**Post date:** [February 27, 2021, 7:48pm UTC](https://forum.mautic.org/t/extending-api-config-controller-namespace-issues/18354/1 "2021-02-27T19:48:52Z")

</div>

**Your software**  
My Mautic version is: 3.3.1  
My PHP version is: 7.3.20  
My Database type and version is: SQLLite 3.27.2

**Your problem**  
My problem is:

First tried the `/assets/new` POST route to attempt to create asset/file from postman. However, the docs say “same as GET assets” so I’m not sure its even possible to create an asset via Rest API (if so please just tell me if possible).

Instead now, trying to make a plugin that extends API. It will eventually receive a string in request body and create a .ical asset file and return its’ id/filename, so it can be attached in an email.  
But am new to PHP and missing something very basic here (namespace issue?).

> **[Projects · Scott Horlacher / SonityIcalMauticBundle](https://gitlab.sonity.net/nacmonad/sonityicalmauticbundle/)**
>
> A Mautic plugin that adds the assets/new\_ical route: -Takes in the text string of the raw ical, saves into assets as .ics. -Returns the asset ID of the...

These errors are showing in the log:  
`[2021-02-27 19:06:31] mautic.CRITICAL: Uncaught PHP Exception LogicException: "Controller not found: service "SonityIcalMauticBundle" does not exist." at /var/www/html/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php line 75 {"exception":"[object] (LogicException(code: 0): Controller not found: service \"SonityIcalMauticBundle\" does not exist. at /var/www/html/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php:75)"} []`

The issue showed up when I started to introduce the /Controller/Api/IcalsController.php – it is referenced in the /Config/config.php :  
`'api' => array( 'plugin_sonityicalmautic_api' => array( 'path' => '/icals', 'controller' => 'SonityIcalMauticBundle:Api\IcalsApi', 'method' => 'GET' ) ),`

The `Controller/Api/IcalsController.php` uses the namespace  
`namespace MauticPlugin\SonityIcalMauticBundle\Controller\Api;` and contains the classname `IcalsController`.

Steps I have tried to fix the problem:

- renamed IcalsController.php
- changed config references

I’m sorry to disturb – but I seem to be unable to get this basic example together. I’m more or less referencing the HelloWorldBundle example as well as [developer-documentation/\_plugin\_extending\_api.md at e84a3a8c4fac393782172349ffdbea903717c964 · mautic/developer-documentation · GitHub](https://github.com/mautic/developer-documentation/blob/e84a3a8c4fac393782172349ffdbea903717c964/source/includes/_plugin_extending_api.md#routes)

A working boilerplate example, or a useful tutorial would help a great amount thanks!

Best,  
nacmonad
