How to create new API endpoint by creating new plugin in PHP?

I want to create a new API endpoint by creating a plugin using PHP.
I am following this documentation but it is not working for me, It is installing the plugin but not working for an endpoint.

https://developers.shopware.com/developers-guide/rest-api/plugin-api-extension/

You are giving a link to the shopware 5 documentation but posting in the shopware 6 forum.
Which shopware version are you using now? For shopware 6, use this guide instead:

Thanks for the reply, @AlexGalax
I am now following that documentation with shopware 6.4 on my local system.

But facing errors while installing and activating the extension.

2023-04-20T00:45:21.577+0530 FATAL unknown extension type

Can you please suggest, what is wrong here?

How am I supposed to do that?

Is that necessary to have a cloud store to create a new extension or we can create and install a new extension on the local shopware store as well?

You can create custom routes on any Shopware installation

I am using this command to activate the extension.

shopware-cli project extension upload . --activate

But it is throwing an error :

pware-cli project extension upload [flags]

Flags:
–activate Installs, Activates, Updates the extension
-h, --help help for upload
–increase-version Increases extension version before uploading

Global Flags:
–config string config file (default is $HOME/.shopware-cli.yaml)
–project-config string Path to .shopware-project.yml (default „.shopware-project.yml“)
–verbose show debug output

2023-04-21T01:01:40.661+0530 FATAL unknown extension type

Here is my menifes.xml file and it is at location „/var/www/html/shopware/custom/apps“.

<?xml version="1.0" encoding="UTF-8"?> punchoutgreenwing Punchout Greenwing Extenssion This app adds a Topseller API endpoint Greenwing Technology (c) Greenwing Technology 1.0.0 MIT order order_line_item product

When I am installing that extension using cli command : shopware-cli project extension upload punchoutgreenwing --activate

I m getting error :: 2023-04-21T02:30:14.547+0530 FATAL unknown extension type