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

**URL:** <https://forum.shopware.com/t/how-to-create-new-api-endpoint-by-creating-new-plugin-in-php/99383>\
**Category:** Programmierung\
**Created:** [18. April 2023 um 19:53 UTC](https://forum.shopware.com/t/how-to-create-new-api-endpoint-by-creating-new-plugin-in-php/99383 "2023-04-18T19:53:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tejas.parmar](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@tejas.parmar](https://forum.shopware.com/u/tejas.parmar)\
**Post date:** [18. April 2023 um 19:53 UTC](https://forum.shopware.com/t/how-to-create-new-api-endpoint-by-creating-new-plugin-in-php/99383/1 "2023-04-18T19:53:05Z")

</div>

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/](https://developers.shopware.com/developers-guide/rest-api/plugin-api-extension/)

---

<div class="post-metadata">

**Author:** ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)\
**Post date:** [19. April 2023 um 06:22 UTC](https://forum.shopware.com/t/how-to-create-new-api-endpoint-by-creating-new-plugin-in-php/99383/2 "2023-04-19T06:22:04Z")

</div>

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:

> **[Starter Guide - Add an API endpoint](https://developer.shopware.com/docs/guides/plugins/apps/starter/add-api-endpoint)**

---

<div class="post-metadata">

**Author:** ![tejas.parmar](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@tejas.parmar](https://forum.shopware.com/u/tejas.parmar)\
**Post date:** [19. April 2023 um 19:22 UTC](https://forum.shopware.com/t/how-to-create-new-api-endpoint-by-creating-new-plugin-in-php/99383/3 "2023-04-19T19:22:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)\
**Post date:** [20. April 2023 um 06:02 UTC](https://forum.shopware.com/t/how-to-create-new-api-endpoint-by-creating-new-plugin-in-php/99383/4 "2023-04-20T06:02:42Z")

</div>

How am I supposed to do that?

---

<div class="post-metadata">

**Author:** ![tejas.parmar](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@tejas.parmar](https://forum.shopware.com/u/tejas.parmar)\
**Post date:** [20. April 2023 um 11:18 UTC](https://forum.shopware.com/t/how-to-create-new-api-endpoint-by-creating-new-plugin-in-php/99383/5 "2023-04-20T11:18:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)\
**Post date:** [20. April 2023 um 12:01 UTC](https://forum.shopware.com/t/how-to-create-new-api-endpoint-by-creating-new-plugin-in-php/99383/6 "2023-04-20T12:01:55Z")

</div>

You can create custom routes on any Shopware installation

> **[Add custom controller](https://developer.shopware.com/docs/guides/plugins/plugins/storefront/add-custom-controller)**

---

<div class="post-metadata">

**Author:** ![tejas.parmar](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@tejas.parmar](https://forum.shopware.com/u/tejas.parmar)\
**Post date:** [20. April 2023 um 19:56 UTC](https://forum.shopware.com/t/how-to-create-new-api-endpoint-by-creating-new-plugin-in-php/99383/7 "2023-04-20T19:56:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tejas.parmar](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@tejas.parmar](https://forum.shopware.com/u/tejas.parmar)\
**Post date:** [20. April 2023 um 21:01 UTC](https://forum.shopware.com/t/how-to-create-new-api-endpoint-by-creating-new-plugin-in-php/99383/8 "2023-04-20T21:01:18Z")

</div>

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
