createdotnet / API-Documentation

Create. API Documenation
http://developers.create.net/API-Documentation/
0 stars 2 forks source link

Stock Records and Levels Discussion #10

Closed Dayjo closed 9 years ago

Dayjo commented 9 years ago

I would like to start a discussion about how we could include stock records and stock levels within the Products data model.

Originally I thought we would do it as a seperate request i.e. /products/12345/stock but after a bit of thought, it would be much more useful if it was contained within the product model itself.

My thoughts would be to store it something like;

...
stock: {
     records: [{
        ID: 333,
        options: [{
            "137379": 561041, // Option ID (Colour): Item ID (Red)
            "67266": 12224, // Size: Large
        }],
        quantity: 5
     }],

     total_quantity: 5,
}

Where the numbers in the options object relate directly to the IDs in the options in the root of the product data model;

"options":[{  
            "ID":"137379",
            "title":"Colour",
            "required":"1",
            "items":[  
                {  
                    "ID":"561041",
                    "title":"Red",
                    "price_adjustment":"0.00",
                    "weight_adjustment":"0.000",
                    "is_custom_input":"0"
                },
                {  
                    "ID":"561045",
                    "title":"Blue",
                    "price_adjustment":"0.00",
                    "weight_adjustment":"0.000",
                    "is_custom_input":"0"
                }
            ]
}]

Any thoughts? @skmbr @AidanThreadgold @Create-Ed @robertoldaker