Shopify: Is it possible to find a product by sku number? - shopify

The data that I'm getting only contains the SKU numbers. I am trying to figure out how I can link these SKU numbers to the product variants in Shopify without the actual product id number.
Example data:
<Inventory ItemNumber="100B3001-B-01">
<ItemStatus Status="Avail" Quantity="0" />
</Inventory>
<Inventory ItemNumber="100B3001-B-02">
<ItemStatus Status="Avail" Quantity="0" />
</Inventory>
<Inventory ItemNumber="100B3001-B-03">
<ItemStatus Status="Avail" Quantity="-1" />
<ItemStatus Status="Alloc" Quantity="1" />
</Inventory>
<Inventory ItemNumber="100B3001-B-04">
<ItemStatus Status="Avail" Quantity="-1" />
<ItemStatus Status="Alloc" Quantity="1" />
</Inventory>

Here's a delightful, condescending discussion from Shopify employees in 2011 asking why you can't just store the Shopify ID everywhere. The "stock-keeping unit" is a universal systems integration point and, in every system I've seen, each SKU uniquely maps to a product because words have meaning, but apparently not at Shopify.
Three years later, you seem to have two options.
One is to create a Fulfillment Service and provide a URL where Shopify will call you asking for stock levels on a SKU; this is probably the simplest solution, provided you have a Web server sitting somewhere where you can expose such a callback.
The second is to periodically page through all of the Products and store a mapping of the Shopify ID to a SKU somewhere, consulting your map when you need to do an update. Because most of our integrations are cron jobs and I'd like to keep them that way, I periodically ask for the products that have changed since the last run, and then update my mapping.

As David Lazar points out in his comment, the ability to find a product based on its SKU is not currently supported in the Shopify API.

EDIT: This is an unreliable option that I once used as a last resort. I wouldn't recommend using this but I will leave it here in case as someone may find it helpful.
You can use this API endpoint:
/admin/products/search.json?query=sku:abc123
I have only used it in the browser though, and I can't find any documentation for it. And it may stop working at any time.

You can use
*.myshopify.com/search?view=json&q=sku:SKUID

Graph query on Shopify works for me:

Related

Getting sequence of associated Product - IBM

I want to get 'Rank' value from MASSOCCECE table, since past 2 days I have been searching a lot to get this value but failed I tried 'ProductDatBean', 'RelatedProductDataBean' but couldn't figure out how to get the value of 'rank'.
I have four products as cross-sell of a product and I want to sort them on the basis of 'rank'.
It would be a great help if anyone could tell me how to get this value besides using customized bean.
EDIT: For more clarity, adding my code
<wcbase:useBean id="g_mA" classname="com.ibm.commerce.catalog.beans.ProductDataBean" >
<c:set target="${g_mA}" property="productID" value="${catentry_ID}" />
</wcbase:useBean>
<c:set var="g_associatedProducts" value="${g_mA.productCrossSells}" scope="request"/>
<c:forEach var="associatedProducts" items="${g_associatedProducts}" varStatus="status">
${associatedProducts.rank}
</c:forEach>
Got the value, thanks everyone for responses.
I was doing the right thing (${associatedProducts.rank}) for getting this value but I was misguided a little , They were items that were associated and I was informed that they were Products, so getting blank while implementing this logic for Item. Used ItemBean now everything is working fine.

QuickBooks IPP Rest API 3.0 CustomerRef in Invoice

When I use the IPP Rest API 3.0 to create a invoice, a example like this:
<Invoice xmlns="http://schema.intuit.com/finance/v3">
<Line>
<Description>Installation labor</Description>
<Amount>420.00</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef>33</ItemRef>
</SalesItemLineDetail>
</Line>
<CustomerRef>20</CustomerRef>
</Invoice>
In this example, 20 is the Id of this customer.
Now, for a third party program, it might not know the Id of this customer, might know the Name of the customer, so , I understand I can always query the customer to get the Id back first, then use that Id in this invoice creating format.
But my question is, can I just use the name without specify the Id of this customer to create this invoice?
Will the following works?
<Invoice xmlns="http://schema.intuit.com/finance/v3">
<Line>
<Description>Installation labor</Description>
<Amount>420.00</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef>33</ItemRef>
</SalesItemLineDetail>
</Line>
<CustomerRef name="ACB Company"></CustomerRef>
</Invoice>
Further more, If it DOES work, does this logic apply to all the ReferenceType in the API?
No. In API payload, you can't refer objects by name ( this behavior was partially supported in old V2 API which is now deprecated ).
You can verify this behavior using Apiexplorer.
https://developer.intuit.com/apiexplorer?apiname=V3QBO
In this case, you should query the customer by name and then extract the ID to refer it in the invoice create payload.
Thanks

eBay API call AddItem using item's UPC code

I want to add products using AddItem API call in eBay with UPC code. I have searched about it, but did not get any specific answer. I want to ask what will be the UPC code for item that will be added in to the eBay list.
Please help me.
Thanks & Regards
This is an old question, and surely you have moved on. But surprisingly no other related examples here on stackoverflow or at developer.ebay.com were to be found when I ran into a similar need with the eBay API AddFixedPriceItem (almost exactly identical to AddItem but aimed at non-auction listings). Here is the XML request structure that worked for me in POSTing to this API for UPC or ISBN coded products illustrated using the Verify version of the API:
<?xml version="1.0" encoding="utf-8"?>
<VerifyAddFixedPriceItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>YOUR TOKEN STRING HERE</eBayAuthToken>
</RequesterCredentials>
<Item>
<AutoPay>false</AutoPay>
<Country>US</Country>
<Currency>USD</Currency>
<ListingType>FixedPriceItem</ListingType>
<ListingDuration>Days_30</ListingDuration>
<PaymentMethods>PayPal</PaymentMethods>
<PaymentMethods>VisaMC</PaymentMethods>
<PayPalEmailAddress>SELLER PAYPAL EMAIL ADDR HERE</PayPalEmailAddress>
<ProductListingDetails>
<UPC>BARCODE HERE</UPC>
<EAN>Does not apply</EAN>
<ListIfNoProduct>true</ListIfNoProduct>
<UseStockPhotoURLAsGallery>true</UseStockPhotoURLAsGallery>
</ProductListingDetails>
<ShippingDetails>
<ShippingServiceOptions>
<ShippingService>USPSFirstClass</ShippingService>
<ShippingServiceCost currencyID="USD">3.00</ShippingServiceCost>
<ShippingServiceAdditionalCost>1.00</ShippingServiceAdditionalCost>
<ShippingServicePriority>1</ShippingServicePriority>
<ShippingService>USPSPriority</ShippingService>
<ShippingServiceCost currencyID="USD">5.00</ShippingServiceCost>
<ShippingServiceAdditionalCost>2.00</ShippingServiceAdditionalCost>
<ShippingServicePriority>2</ShippingServicePriority>
</ShippingServiceOptions>
<ShippingType>Flat</ShippingType>
</ShippingDetails>
<ShipToLocations>US</ShipToLocations>
<Quantity>1</Quantity>
<Site>US</Site>
<StartPrice currencyID="USD">1.99</StartPrice>
<Title>YOUR GREAT ITEM TITLE</Title>
<Location>CITY,STATE HERE</Location>
<PictureDetails>
<GalleryType>Gallery</GalleryType>
</PictureDetails>
<DispatchTimeMax>3</DispatchTimeMax>
<ReturnPolicy>
<RefundOption>MoneyBack</RefundOption>
<Refund>Money Back</Refund>
<ReturnsWithinOption>Days_30</ReturnsWithinOption>
<ReturnsWithin>30 Days</ReturnsWithin>
<ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption>
<ReturnsAccepted>Returns Accepted</ReturnsAccepted>
<ShippingCostPaidByOption>Buyer</ShippingCostPaidByOption>
<ShippingCostPaidBy>Buyer</ShippingCostPaidBy>
</ReturnPolicy>
<ConditionID>EBAY CONDITION CODE</ConditionID>
<ConditionDisplayName>EBAY CONDITION DISPLAY TEXT</ConditionDisplayName>
</Item>
<ErrorLanguage>en_US</ErrorLanguage>
<WarningLevel>Low</WarningLevel>
</VerifyAddFixedPriceItemRequest>
This is the VerifyAddFixedPriceItem call, which again is very very similar to the VerifyAddItem API. You can use the Verify version of either to check out that the request will be OK once debugged (just don't trust the fees either of them report even in production). The AddFixedPriceItem API adds the item to eBay using the UPC code only, via the eBay product catalog content. You can replace <UPC> and </UPC> with <ISBN> and </ISBN> for books as well. You could use this as an XML template for the VerifyAddItem and AddItem APIs as well.
Text in CAPS needs to be customized, the shipping prices are just random for illustration. I ran this using eBay Trading API version 1001 (as of this posting date you can ignore the warnings about no seller profile being in place). Also you can find the eBay condition codes and name text here: eBay Condition ID Values and Names
Hope this helps you or someone else that comes along with a similar need.

eBay API call RelistFixedPriceItem doesn't accept a ListingType of "FixedPriceItem"

I am trying to use the eBay API call RelistFixedPriceItem relist an item as fixed price which has been listed as an auction before.
The "interesting part" of my XML request looks like this:
<RelistFixedPriceItemRequest>
<Item>
<ListingType>
FixedPriceItem
</ListingType>
</Item>
</RelistFixedPriceItemRequest>
But still, eBay responds that I can't use the ListingType I used ("FixedPriceItem") but should use "FixedPriceItem" (the same) instead:
<RelistFixedPriceItemResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2013-06-21T14:14:52.951Z</Timestamp>
<Ack>Failure</Ack>
<Errors>
<ShortMessage>Unsupported ListingType.</ShortMessage>
<LongMessage>Valid Listing type for fixedprice apis are FixedPriceItem and StoresFixedPrice.</LongMessage>
<ErrorCode>21916286</ErrorCode>
<SeverityCode>Error</SeverityCode>
<ErrorClassification>RequestError</ErrorClassification>
</Errors>
<Version>827</Version>
<Build>E827_UNI_API5_16161102_R1</Build>
</RelistFixedPriceItemResponse>
Has anyone run into this issue - or found a workaround?
Nothing in their API documentation states that this shouldn't be possible. It certainly is on ebay.com where you can change the listing type when you relist an item.
Well, If you look at their API documentation's Sample XML, you would notice that they do not use
<ListingType>
FixedPriceItem
</ListingType>
That suggests to me that, when you use the RelistFixedPriceItem call you do not have to specify the Listing Type to be FixedPriceItem
I do agree that it is a confusing error.

list=alllinks confusion

I'm doing a research project for the summer and I've got to use get some data from Wikipedia, store it and then do some analysis on it. I'm using the Wikipedia API to gather the data and I've got that down pretty well.
What my questions is in regards to the links-alllinks option in the API doc here
After reading the description, both there and in the API itself (it's down and bit and I can't link directly to the section), I think I understand what it's supposed to return. However when I ran a query it gave me back something I didn't expect.
Here's the query I ran:
http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=google&rvprop=ids|timestamp|user|comment|content&rvlimit=1&list=alllinks&alunique&allimit=40&format=xml
Which in essence says: Get the last revision of the Google page, include the id, timestamp, user, comment and content of each revision, and return it in XML format.
The allinks (I thought) should give me back a list of wikipedia pages which point to the google page (In this case the first 40 unique ones).
I'm not sure what the policy is on swears, but this is the result I got back exactly:
<?xml version="1.0"?>
<api>
<query><normalized>
<n from="google" to="Google" />
</normalized>
<pages>
<page pageid="1092923" ns="0" title="Google">
<revisions>
<rev revid="366826294" parentid="366673948" user="Citation bot" timestamp="2010-06-08T17:18:31Z" comment="Citations: [161]Tweaked: url. [[User:Mono|Mono]]" xml:space="preserve">
<!-- The page content, I've replaced this cos its not of interest -->
</rev>
</revisions>
</page>
</pages>
<alllinks>
<!-- offensive content removed -->
</alllinks>
</query>
<query-continue>
<revisions rvstartid="366673948" />
<alllinks alfrom="!2009" />
</query-continue>
</api>
The <alllinks> part, its just a load of random gobbledy-gook and offensive comments. No nearly what I thought I'd get. I've done a fair bit of searching but I can't seem to find a direct answer to my question.
What should the list=alllinks option return?
Why am I getting this crap in there?
You don't want a list; a list is something that iterates over all pages. In your case you simply "enumerate all links that point to a given namespace".
You want a property associated with the Google page, so you need prop=links instead of the alllinks crap.
So your query becomes:
http://en.wikipedia.org/w/api.php?action=query&prop=revisions|links&titles=google&rvprop=ids|timestamp|user|comment|content&rvlimit=1&format=xml