peskywinnets
Registered User.
- Local time
- Today, 13:15
- Joined
- Feb 4, 2014
- Messages
- 578
I sell on Amazon & am slowly kludging together some code to use their API to pull in stock levels (I give them stock & they store it in their warehouse...so I need to know how much stock they hold for me) ...but I would like to know what the best approach is to make sure that the returned stock levels goes against the correct SKU (product code) within access, else it would be catastrophic.
So to retrieve the information, I have an access table that I step through ...Amazon give me the option to request up to 50 SKUs at a time (it's better to request as many SKUs as possible at a time, as they aren't keen on you doing lots of requests - they throttle you back if you do). So I request the data in chunks of 50 Products (I have sell about 140 products, so it'l;l be 3 separate 'chunks' requested)
Now then, if I were retrieving one SKU at a time, then it'd be easy matching the requested data against the retrieved data (it'd be 1-1), but if I'm requesting 50 SKUs, the XML is going to be returned with 50 SKU's stock levels within....so what the best way of handling that?
For example, let's say I'm requesting stock levels for...
Product A
Product B
Product C
Amazon sends me back the XML (which I'll simplify) as
Product A 50
Product B 5
Product C 1
I need to make sue that those quantities go into the right quantity field for each product in Access.....it needs to be robust.
My thought is to store the returned data into a temporary 'holding tabl'e (populating it in 3 chunks with the returned data), then afterwards run an update query to update the quantity in my permanent table (linking the temp table & permanent table by SKU name)...at least this way I can be assured that the right stock levels have gone against the correct SKU. Plausible or would there be a more standard way of doing this?
Sorry if it appears a basic question - I'm still fairly new to VBA & particularly VBA usage within Access.
So to retrieve the information, I have an access table that I step through ...Amazon give me the option to request up to 50 SKUs at a time (it's better to request as many SKUs as possible at a time, as they aren't keen on you doing lots of requests - they throttle you back if you do). So I request the data in chunks of 50 Products (I have sell about 140 products, so it'l;l be 3 separate 'chunks' requested)
Now then, if I were retrieving one SKU at a time, then it'd be easy matching the requested data against the retrieved data (it'd be 1-1), but if I'm requesting 50 SKUs, the XML is going to be returned with 50 SKU's stock levels within....so what the best way of handling that?
For example, let's say I'm requesting stock levels for...
Product A
Product B
Product C
Amazon sends me back the XML (which I'll simplify) as
Product A 50
Product B 5
Product C 1
I need to make sue that those quantities go into the right quantity field for each product in Access.....it needs to be robust.
My thought is to store the returned data into a temporary 'holding tabl'e (populating it in 3 chunks with the returned data), then afterwards run an update query to update the quantity in my permanent table (linking the temp table & permanent table by SKU name)...at least this way I can be assured that the right stock levels have gone against the correct SKU. Plausible or would there be a more standard way of doing this?
Sorry if it appears a basic question - I'm still fairly new to VBA & particularly VBA usage within Access.
Last edited: