Error to fetch JSON product

Hello,
Are there more complete logs than the developers logs of our dashboard?

Indeed, I encounter a problem to fetch a product from the dashboard. The interface returns an error without details for the following JSON:

{
  "id": 3,
  "name": "Produit test avec variation",
  "price": 14.5,
  "variants": [
    {
      "variation": {
        "name": "Couleur",
        "option": "Rouge"
      }
    },
    {
      "variation": {
        "name": "Couleur",
        "option": "Jaune"
      }
    },
    {
      "variation": {
        "name": "Taille",
        "option": "S"
      }
    },
    {
      "variation": {
        "name": "Taille",
        "option": "M"
      }
    },
    {
      "variation": {
        "name": "Taille",
        "option": "L"
      }
    }
  ],
  "customFields": [
    {
      "name": "Couleur",
      "options": "Rouge[+5.00]|Jaune[-5.00]",
      "type": "dropdown"
    },
    {
      "name": "Taille",
      "options": "S[-10.00]|M|L[+10.00]",
      "type": "dropdown"
    }
  ]
}

Maybe there is a complete reference of the expected model? with constraints, formats and mandatory nodes?
Or an interface with more complete logs?
Because for the moment, I only see examples not detailed in the doc

Thanks for your help

Hi @digitalyz, thanks for reaching out.

The only missing value I can see in your JSON is the URL, but maybe you omitted that for the post.

Can you let us know which version of Snipcart you are using?

We do have some internal logs, but once we find the issue with your JSON I can file a feature request, so we return a better message for that case.

Thanks.

Thanks for your feedback.
Indeed there is not yet the url in the JSON.

I found that if I go through the Fetch option in the Dashboard, it doesn’t work.
If we create a button on a site with the Snipcart cart and place a test order, the order is validated with the JSON.

Thanks

Hello,
We have made progress in our tests.
It seems that it is the “variants” node that is causing the problem.
Indeed, if we modify the JSON so as not to return the “variants” node, we have no error with the Fetch function of the Dashboard.
And as soon as we add the node, the problem comes back.

Here is a node example, do you see a problem in its definition?

variants": [
      {
        "variation": {
          "name": "Taille",
          "option": "S"
        },
        "stock": 10,
        "allowOutOfStockPurchases": false
      },
      {
        "variation": {
          "name": "Taille",
          "option": "M"
        },
        "stock": 2,
        "allowOutOfStockPurchases": true
      },
      {
        "variation": {
          "name": "Taille",
          "option": "L"
        },
        "stock": 0,
        "allowOutOfStockPurchases": false
      }
    ]

Thanks

the problem came from the variation node. It should be an array and not an object !
Thanks

1 Like