Zend certified PHP/Magento developer

Magento Cannot instantiate interface

I wrote a custom api for magento 2.3.1

When i call the endpoint that i was created i get the following error

{
"messages": {
    "error": [
        {
            "code": 500,
            "message": "Server internal error. See details in report api/1560842508114"
        }
    ]
}
}

Report detail:

“Fatal Error: ‘Uncaught Error: Cannot instantiate interface DemoHelloApiHelloInterface in /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:116nStack trace:n#0 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): MagentoFrameworkObjectManagerFactoryAbstractFactory->createObject(‘Demo\Hello\Api\…’, Array)n#1 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): MagentoFrameworkObjectManagerFactoryCompiled->create(‘Demo\Hello\Api\…’)n#2 /var/www/html/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(90): MagentoFrameworkObjectManagerObjectManager->get(‘Demo\Hello\Api\…’)n#3 /var/www/html/vendor/magento/module-webapi/Controller/Rest.php(188): MagentoWebapiControllerRestSynchronousRequestProcessor->process(Object(MagentoFrameworkWebapiRestRequestProxy))n#4 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): MagentoWebapiControllerRest->dispatch(Object(MagentoFr’ in ‘/var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php’ on line 116”

app/code/Demo/registration.php

< ?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Demo_Hello',
__DIR__
);

app/code/Demo/Api/HelloInterface.php

< ?php
namespace DemoHelloApi;
interface HelloInterface
{
   /**
   * Returns greeting message to user
   *
   * @api
   * @param string $name Users name.
   * @return string Greeting message with users name.
   */
   public function name($name);
}

app/code/Demo/etc/di.xml

< ?xml version="1.0"?>


app/code/Demo/registration.php

< ?php
namespace DemoHelloModel;
use DemoHelloApiHelloInterface;
class Hello implements HelloInterface
{
   /**
   * Returns greeting message to user
   *
   * @api
   * @param string $name Users name.
   * @return string Greeting message with users name.
   */
   public function name($name) {
      return "Hello, " . $name;
   }
}