how should look payload to put product in a cart.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 anno tempo fa
Getting error with shoppingCartType. Request is addProductToCartFromDetails. I  am trying to make a request with fetcher library.

My payload looks like this. From this i am getting  shoppingCartType is required
payload1:
{
  productId: 1,
  shoppingCartType: "ShoppingCart",
}
another payload looks like this:
payload2:
``
{
  productId: Number(_productId.value),
  shoppingCartType: {
    shoppingCartType: "ShoppingCart",
  },
}
``
but from it  i got this error {
    "errors": {
        "shoppingCartType": [
            "Unexpected character encountered while parsing value: {. Path 'shoppingCartType', line 1, position 21.",
            "After parsing a value an unexpected character was encountered: :. Path 'shoppingCartType', line 1, position 39."
        ]
    },
    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
    "title": "One or more validation errors occurred.",
    "status": 400,
    "traceId": ""
}
1 anno tempo fa
Trailing commas are not allowed in JSON.

{
  productId: 1,
  shoppingCartType: "ShoppingCart",  <<<<REMOVE COMMA
}



(In the future, please indicate "WebAPI" in the topic name for such issues :)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.