Skip to main content
Solved

Updating Attributes for a StockItem (REST)

  • Dec 1, 2023 12:29 AM UTC
  • 3 replies
  • 287 views
  • Translate All

Forum|alt.badge.img+2

For some reason, I am required to pass the AttributeID when updating the value for a StockItem attribute. I’m using this URL:

https://site.com/entity/Default/22.200.001/StockItem

 

For example, when I want to update “Color”, I have to pass this in the JSON body

    "Attributes": [

        {

            "AttributeID": {

                "value": "A372"

            },

            "Value": {

                "value": "Black"

            }

        }

    ],

Instead of finding all the IDs, I want to be able to just pass this:

    "Attributes": [

        {

            "Attribute": {

                "value": "Color"

            },

            "Value": {

                "value": "Black"

            }

        }

    ],

Does anyone know how to do this?

Best answer by jinin

Hi @bpgraves 

In the JSON request, you can pass the 'AttributeID' as 'Color'; there is no need to include any 'Ids'


Sample JSON:
{

    "InventoryID": {

        "value": "AACOMPUT01"

    },

    "Description": {

        "value": "Acer Laptop Computer"

    },

    "Attributes": [

        {

            "AttributeID": {

                "value": "COLOR"

            },

            "Value": {

                "value": "BLUE"

            }

        },

        {

            "AttributeID": {

                "value": "WIDEANGLE"

            },

            "Value": {

                "value": "WIDE2"

            }

        }

    ]

}

View original

3 replies

Forum|alt.badge.img+8
  • Captain II
  • Dec 1, 2023 4:55 AM UTC

Does this discussion help?

 

Translate

jinin
Pro I
Forum|alt.badge.img+12
  • Pro I
  • Answer
  • Dec 1, 2023 10:34 AM UTC

Hi @bpgraves 

In the JSON request, you can pass the 'AttributeID' as 'Color'; there is no need to include any 'Ids'


Sample JSON:
{

    "InventoryID": {

        "value": "AACOMPUT01"

    },

    "Description": {

        "value": "Acer Laptop Computer"

    },

    "Attributes": [

        {

            "AttributeID": {

                "value": "COLOR"

            },

            "Value": {

                "value": "BLUE"

            }

        },

        {

            "AttributeID": {

                "value": "WIDEANGLE"

            },

            "Value": {

                "value": "WIDE2"

            }

        }

    ]

}

Translate

Forum|alt.badge.img+2
  • Author
  • Semi-Pro III
  • Dec 1, 2023 5:38 PM UTC

Does this discussion help?

 

Actually this discussion is what caused my problem since using Attribute (unlike AttributeID) didn’t change any data.  In fact, using Attribute (like that discussion recommends) has no effect whatsoever on the Stock Item.  I was able to finally get it working using “Color” for AttributeID.

Translate