question

mightynoobster avatar image
mightynoobster asked jim-patel answered

V3 REST API Field Expansion

I have been looking for help on google, but have not found anything to work yet. Since this is the API I am using, I thought I would ask here. I found the API Documentation, but has not helped me solve this problem.

Trying to create a Modifier Group with several Modifiers at the same time.

POST to https://api.clover.com/v3/merchants/[... ID]/modifier_groups?expand=modifiers

{"name":"test-group","modifiers":{"elements":[{"name":"Big","price":900},{"name":"Medium","price":800},{"name":"Small","price":700},{"name":"Mini","price":700},{"name":"Small - 2","price":700},{"name":"Mini - 2","price":700}]}}

The Modifier Group is created, but without any modifiers.

The response is:

{"id": "5YBM796AAY3C6", "name": "test-group", "showByDefault": true, "modifiers": {"elements": [ ]}}

What am I missing?

Thank you for any help.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jim-patel avatar image
jim-patel answered

I believe you have to create a modifier group and create each modifier in separate POSTs. My assumption to the use for field expansion is for GETs, to get information that isn't returned by a GET by default.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jacob Abrams avatar image
Jacob Abrams answered

You will need to make multiple calls to the server to accomplish your goal. Field expansion only works for GET calls not for POST. After creating your modifier group you can then add modifiers to it one at a time using this endpoint: /v3/merchants/{mId}/modifier_groups/{modGroupId}/modifiers

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community