Stock not properly recording

products

#1

Hi, I’m using Postman to test posting a product (the complete json below).

I receive the response product id but

  1. the timestamps.create_at is not shown in the response
  2. the stock is also not working as this is the response:
            "stock": {
                "level": 0,
                "availability": "out-stock"
            }

Request body:

{
    "data": {
        "type": "product",
        "name": "To Pixar and Beyond: My Unlikely Journey with Steve Jobs to Make Entertainment History",
        "slug": "to-pixar-and-beyond-my-unlikely-journey-with-steve-jobs-to-make-entertainment-history",
        "sku": "1328745619",
        "description": "My Unlikely Journey with Steve Jobs to Make Entertainment History",
        "manage_stock": true,
        "price": [
            {
                "amount": 1000,
                "currency": "SGD",
                "includes_tax": true
            }
        ],
        "meta": {
            "timestamps": {
                "created_at": "2018-01-20T12:42:32+08:00"
            },
            "stock": {
                "level": 1,
                "availability": "in-stock"
            }
        },
        "status": "live",
        "commodity_type": "physical",
        "language": "eng",
        "isbn": "1328745619",
        "isbn13": "9781328745613",
        "authors": "Lawrence Levy",
        "dimension": "",
        "subjects": "pixar, business, animation",
        "condition": "new",
        "publisher": "Mariner Books"
    }
}

Thanks for help!


#2

Hey @iosdev

In your request body there is no need to have the data.meta attributes - that is for the API to return some useful meta data back rather than you sending it.

For example, the created_at time is something we generate, not user supplied.

Instead, if you can make sure that your request body has a data.stock key with an integer as a value:

{
    "data": {
        .... // your current attributes
        "stock": 1,
        .... // any other attributes
    }
}

Then we you get the product you should see the stock level in the meta section of the response…


#3

Aah I see :thinking: Thanks for your help @andrew!


#4

Update: it works!

@andrew I’m seeing this Missing translation: catalogue.tables.prod from Dashboard. Is this a bug?


#5

Great, thanks for the update - I’ll get our frontend team to take a look at the dashboard for you!


#6

Hey @iosdev. I’d love to get to the bottom of the issue you’re see in dashboard. I’m going to send you a DM, let’s talk there :smile:


#7

This dashboard issue has been patched. Awaiting deployment :rocket:


#8

Awesome! thanks @jonathan


#9