question

almosteric avatar image
almosteric asked David Marginian Deactivated commented

v3 assign items to modifier groups and categories confusion

Admittedly a bit late, but we are switching some old code from Clover v2 to v3. Most of it is working now except the "new" way of assigning modifier groups to items and items to categories.

I'll just refer to modifier groups but the issue is same for both calls.

So we are POSTing to the merchants/mid/item_modifier_groups endpoint and there is a discrepancy in the documentation. In the API reference it say we should POST { "item" : {"id" : "itemid" } } , {"modifierGroup" : {"id" : "modifierGroupId" } } }

When we do this we get a {} returned and nothing happens.

If you click in the API documentation on : https://docs.clover.com/docs/using-object-associations

There the payload is supposed to be an Array within an "elements" tag.

When we do that we get a Bad Request error.

How do we get this working again?



REST APIModifiers
10 |2000

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

David Marginian avatar image
David Marginian Deactivated answered
10 |2000

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

almosteric avatar image
almosteric answered David Marginian Deactivated commented

no, this does not help

It is the exact issue that I stated above.

If I just post the item ID and modifier ID as I described above (which is what is, as mentioned, in your API reference, nothing happens)

If I use the format in the link you gave with the the item and modifier wrapped in an elements tag, I get a bad request error

1 comment
10 |2000

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

David Marginian avatar image David Marginian ♦♦ commented ·

I just tried the API and it works for me as documented:

curl --location --request POST 'https://sandbox.dev.clover.com/v3/merchants/redacted/item_modifier_groups' \
--header 'Authorization: Bearer redacted' \
--header 'Content-Type: application/json' \
--data-raw '{
    "elements": [
        {
            "modifierGroup": {
                "id": "redacted"
            },
            "item": {
                "id": "redacted"
            }
        }
    ]
}'
0 Likes 0 ·
almosteric avatar image
almosteric answered David Marginian Deactivated commented

Ok, after some json editing got the modifier group association working.

Now getting an error with the category assigning with this:

{

"elements" : [

{ "category" : {

"id" : "redacted"

},

"item" : {

"id" : "redacted"

}

}

]

}



1 comment
10 |2000

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

David Marginian avatar image David Marginian ♦♦ commented ·

That works for me too:

curl --location --request POST 'https://sandbox.dev.clover.com/v3/merchants/redacted/category_items' \
--header 'Authorization: Bearer redacted' \
--header 'Content-Type: application/json' \
--data-raw '{
    "elements": [
        {
            "category": {
                "id": "redacted"
            },
            "item": {
                "id": "redacted"
            }
        }
    ]
}'
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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