# Shopware /api/propertyGroups 500 status

**URL:** <https://forum.shopware.com/t/shopware-api-propertygroups-500-status/67752>\
**Category:** Programmierung\
**Created:** [18. Juni 2020 um 07:58 UTC](https://forum.shopware.com/t/shopware-api-propertygroups-500-status/67752 "2020-06-18T07:58:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShopProgrammerWare](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@ShopProgrammerWare](https://forum.shopware.com/u/ShopProgrammerWare)\
**Post date:** [18. Juni 2020 um 07:58 UTC](https://forum.shopware.com/t/shopware-api-propertygroups-500-status/67752/1 "2020-06-18T07:58:07Z")

</div>

Hello,

I am Java developer. I would like to ask about /propertyGroups endpoint returning status 500 Internal Server Error.

The request is&nbsp;{ShopwareAddress}/api/propertyGroups/&nbsp; POST&nbsp; with header application/json

and request body in JSON format - never empty, always at least name parameter e.g.

{

&nbsp;&nbsp;&nbsp;&nbsp;“name”:&nbsp;“shops”

}

The library I use to create the request in Java is com.sun.jersey

The problem appears only for Shopware version 5.6.2, for Shopware version 5.2.16 it works fine - request sent to both is the same.

Moreover, I used POSTMAN for testing and the same request works fine and returns status 201 Created.

Example entries in log file:

{IP}&nbsp;- - [15/Jun/2020:13:56:28 +0200] “POST /api/propertyGroups/ HTTP/1.1” 500 - “-” “Java/11.0.3”

{IP} - user [15/Jun/2020:13:35:28 +0200] “POST /api/propertyGroups/ HTTP/1.1” 201 90 “-” “PostmanRuntime/7.25.0”

I would appreciate any help since I cannot resolve this myself.

Thanks in advance.

&nbsp;

Best regards,

Michael

&nbsp;

---

<div class="post-metadata">

**Author:** ![ahmadsaad](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@ahmadsaad](https://forum.shopware.com/u/ahmadsaad)\
**Post date:** [18. Juni 2020 um 08:12 UTC](https://forum.shopware.com/t/shopware-api-propertygroups-500-status/67752/2 "2020-06-18T08:12:03Z")

</div>

Hallo @ShopProgrammerWare‍,

can you post the php error entries from the log Datei with the full stack trace, so we can help you.

VG,

![image](https://enbit.de/img/logo.svg)

Tel.: +49 755&nbsp;- 183 990 00 | E-Mail: [info@enbit.de](mailto:info@enbit.de) | Web:&nbsp;[http://enbit.de/](http://enbit.de/)

---

<div class="post-metadata">

**Author:** ![ShopProgrammerWare](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@ShopProgrammerWare](https://forum.shopware.com/u/ShopProgrammerWare)\
**Post date:** [18. Juni 2020 um 09:38 UTC](https://forum.shopware.com/t/shopware-api-propertygroups-500-status/67752/3 "2020-06-18T09:38:01Z")

</div>

Hallo @ahmadsaad‍

Thanks for quick answer.

I think you are referring to error logs I can find in var/www/html/shopware{version}/shopware\_error.log

&nbsp;

This is example:

[Mon Jun 15 13:56:28.257277 2020] [php7:error] [pid 23555] [client HIDDEN IP] PHP Fatal error: &nbsp;Uncaught TypeError: Argument 1 passed to Shopware\Models\Property\Group::setOptions() must be of the type array, null given, called in /var/www/html/shopwarece/engine/Shopware/Components/Model/ModelEntity.php on line 53 and defined in /var/www/html/shopwarece/engine/Shopware/Models/Property/Group.php:245  
Stack trace:  
#0 /var/www/html/shopwarece/engine/Shopware/Components/Model/ModelEntity.php(53): Shopware\Models\Property\Group-\>setOptions(NULL)  
#1 /var/www/html/shopwarece/engine/Shopware/Components/Api/Resource/PropertyGroup.php(108): Shopware\Components\Model\ModelEntity-\>fromArray(Array)  
#2 /var/www/html/shopwarece/engine/Shopware/Controllers/Api/PropertyGroups.php(80): Shopware\Components\Api\Resource\PropertyGroup-\>create(Array)  
#3 /var/www/html/shopwarece/engine/Library/Enlight/Controller/Action.php(192): Shopware\_Controllers\_Api\_PropertyGroups-\>postAction()  
#4 /var/www/html/shopwarece/engine/Library/Enlight/Controller/Dispatcher/Default.php(478): Enlight\_Controller\_Action-\>dispatch(‘postAction’)  
#5 /va in /var/www/html/shopwarece/engine/Shopware/Models/Property/Group.php on line 245

&nbsp;

Best Regards,

Michael  
&nbsp;

---

<div class="post-metadata">

**Author:** ![ahmadsaad](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@ahmadsaad](https://forum.shopware.com/u/ahmadsaad)\
**Post date:** [19. Juni 2020 um 10:22 UTC](https://forum.shopware.com/t/shopware-api-propertygroups-500-status/67752/4 "2020-06-19T10:22:23Z")

</div>

Hallo @ShopProgrammerWare‍,

by your example Request you have just ‚name‘ key there are no ‚options‘ key , is this correct??

the function fromArry call only the set functions for the request array keys.

so the Q hier, from where came this ‚options‘ key??

VG,

![image](https://enbit.de/img/logo.svg)

Tel.: +49 755&nbsp;- 183 990 00 | E-Mail: [info@enbit.de](mailto:info@enbit.de) | Web:&nbsp;[http://enbit.de/](http://enbit.de/)

---

<div class="post-metadata">

**Author:** ![shyim](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shyim/32/7681_2.png) [@shyim](https://forum.shopware.com/u/shyim)\
**Post date:** [20. Juni 2020 um 17:10 UTC](https://forum.shopware.com/t/shopware-api-propertygroups-500-status/67752/5 "2020-06-20T17:10:45Z")

</div>

You need to pass an empty array with name “options”

---

<div class="post-metadata">

**Author:** ![ShopProgrammerWare](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@ShopProgrammerWare](https://forum.shopware.com/u/ShopProgrammerWare)\
**Post date:** [23. Juni 2020 um 08:56 UTC](https://forum.shopware.com/t/shopware-api-propertygroups-500-status/67752/6 "2020-06-23T08:56:14Z")

</div>

Hello,

Thanks for your help!

You are right, the cause is NULL parameter as “options”.

My mistake is caused by the fact that this worked for shopware version 5.2.16 (NULL as “options”), so I was just straight up serializing object to JSON and sending.  
And as you say in 5.6.2 version in shopware it ends with status 500.

All is clear now.

Best Regards,

Michael

---

<div class="post-metadata">

**Author:** ![nazeefnezzi](https://avatars.discourse-cdn.com/v4/letter/n/48db29/32.png) [@nazeefnezzi](https://forum.shopware.com/u/nazeefnezzi)\
**Post date:** [31. Januar 2022 um 09:38 UTC](https://forum.shopware.com/t/shopware-api-propertygroups-500-status/67752/7 "2022-01-31T09:38:06Z")

</div>

Ich möchte API aufrufen zum Erstellen/update [POST / PUT] von propertygroup mit Optionsarray aufrufen, aber ich habe 500 Fehler. Mein error log sagt

`"PHP message: PHP Fatal error: Uncaught TypeError: Argument 1 passed to Shopware\Models\Property\Group::addOption() must be an instance of Shopware\Models\Property\Option, array given, called in /var/www/domain/engine/Shopware/Models/Property/Group.php on line 267 and defined in /var/www/domain/engine/Shopware/Models/Property/Group.php:250`

und mein api params ist folgendes:-

www.localhost/api/propertyGroups/5

```auto
{

    "id": 5,

    "name": "test property",

    "position": 0,

    "comparable": false,

    "sortMode": 0,

    "options": [

        {

            "name": "testPropertyOption",

            "filterable": true

        }

    ],

    "attribute": null

}

```

wie ist die richtige api call für herstellen oder actulizieren die propertyGroupeOptions
