Clearer response from BigCommerce - api

Can BigCommerce change their API response to be more clear when a program tries to post a shipment that already exists?
When posting shipments to BigCommerce, if the shipment already exists, then you receive the following error message.
<?xml version="1.0"?>
<errors>
<error>
<status>400</status>
<message>The field 'quantity' is invalid.</message>
<details>
<invalid_reason>The quantity specified is greater than the quantity of the product that is available to ship.</invalid_reason>
<available_quantity>0</available_quantity>
<order_product_id>628</order_product_id>
</details>
</error>
</errors>
I agree that it is a bad request, but it has nothing to do with the quantity of the item. Can we do something like the following for the message or invalid_reason instead?
The shipment [insert ID here] already exists and cannot be added.
This would make for a much more usable API.

When querying the order products resource there is an available quantity to ship, and as you create a shipment(s) the available quantity is reduced to 0.
Initially a shipment POST is successful as the quantity specified in the payload matches that of the order. If you were to POST a shipment to an order that has already been shipped then the available quantity is actually 0, and when you specify a positive integer for quantity in the payload it is invalid and greater than the available quantity, so the error is accurate.

Related

USPS API not returning Commitment Date

My client needs to know how long it will take to ship their time sensitive product for FedEx and USPS. I'm using the GetRates function of DotNetShipping but the Commitment Date is coming back as null and being set to 30 days by DotNetShipping which isn't helpful. Are there particular parameters for the USPS Web Tools API that have to be passed in in order to get a Commitment Date? I know that when I call the USPS API directly, with the following URL, I do get a Commitment Date in the return data.
http://production.shippingapis.com/ShippingAPI.dll?API=RateV4&XML=<RateV4Request USERID="[USPSUSERID]"><Revision>2</Revision><Package ID="2ND"><Service>PRIORITY</Service><ZipOrigination>44106</ZipOrigination><ZipDestination>20770</ZipDestination><Pounds>1</Pounds><Ounces>0</Ounces><Container>RECTANGULAR</Container><Size>LARGE</Size><Width>11</Width><Length>13</Length><Height>11</Height><Girth>55</Girth><Value>1000</Value><SpecialServices><SpecialService>1</SpecialService></SpecialServices></Package></RateV4Request>
The above URL won't work without replacing [USPSUSERID] with a valid user ID.
I had to modify DotNetShipping to pass in Value and SpecialServices -> SpecialService and remove Machinable in order to get the CommitmentDate returned.

SoftLayer API Product_Package 200 getItemPrices returns mulitple (including invalid) priceIds for the same location group issueGrouID

I use the following API to get item price for item id=4281, 4.00 TB SATA disk
https://api.softlayer.com/rest/v3/SoftLayer_Product_Package
/200/getItemPrices?objectMask=mask[item,id,
locationGroupId,hourlyRecurringFee,recurringFee]&objectFilter={itemPrices:
{item:{id:{operation:*=4281}}}}
It gives two priceIds for the each same location group including invalid priceIds.
itemId=4281, locationGrouID=545, priceId=57241,68071
itemId=4281, locationGrouID=503, priceId=66971, 68063
itemId=4281, locationGrouID=505, priceId=68065, 68605
itemId=4281, locationGrouID=507, priceId=68067, 57009
itemId=4281, locationGrouID=583, priceId=153059,153159
itemId=4281, locationGrouID=509, priceId=68069,57131
itemId=4281, locationGrouID="", priceId=21209,21211
Can somebody please fix this API to make it return only single valid priceId for different locationGrouID ?
Thanks.
There is no issue the prices are different from each other, for example:
priceId=57241,68071
the priceId "57241" is valid for all disk (disk1,disk2,etc) except for the disk0, which means that you cannot use this price for the disk0 of your server. The priceId "68071" is valid only for the disk0.
The same behavior is for all the prices that you listed. In order to know which price is valid for what kind of disk you need to see the categories of the price. Try this request and you will see the categories:
https://api.softlayer.com/rest/v3/SoftLayer_Product_Package/200/getItemPrices?objectMask=mask[categories,item,id, locationGroupId,hourlyRecurringFee,recurringFee]&objectFilter={"itemPrices": {"item":{"id":{"operation":"*=4281"}}}}
Regards

SupplyCategoryUnavailable - what does this FBAOutboundServiceMWS error mean?

We have a script for submitting Amazon FBA orders via FBAOutboundServiceMWS, using CreateFulfillmentOrder request.
Orders for some products cannot be placed, we are getting this error:
<ErrorResponse xmlns="http://mws.amazonaws.com/FulfillmentOutboundShipment/2010-10-01/">
<Error>
<Type>Sender</Type>
<Code>InvalidRequestException</Code>
<Message>Value SupplyCategoryUnavailable for parameter MerchantSku is invalid.</Message>
</Error>
<RequestId>22dafce7-7457-4232-b994-efea4f386dca</RequestId>
</ErrorResponse>
There is no information about it in a documentation, and we do not see any difference between products which experience the issue and products which do not.
As it turned, those were SKUs called SNL – small and light program with amazon.com.
Below an answer from Amazon customer support which we have received:
Please confirm with if the items meet these conditions:
Weigh less than or equal to 8 ounces
Have dimensions less than or equal to 9x6x2 inches
Priced under $10
If the above mentioned conditions are met you have to do it manually

Programmatically detect whether Amazon buyer has left a review?

Is it possible to programmatically detect whether an Amazon buyer has left a review on a product? I've been digging through the Product Advertising API to no avail.
you can use retrieving customer reviews portion of the api here:
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/EX_RetrievingCustomerReviews.html
Here is an example of the request:
http://webservices.amazon.com/onca/xml?
Service=AWSECommerceService
&Operation=ItemLookup
&ResponseGroup=Reviews
&IdType=ASIN
&ItemId=B004HFS6Z0
&AssociateTag=[Your_Associate_Tag]
&AWSAccessKeyId=[Your_AWSAccessKeyId]
&Timestamp=[YYYY-MM-DDThh:mm:ssZ]
&Signature=[Request_Signature]
and response:
<Item>
<ASIN>B004HFS6Z0</ASIN>
<CustomerReviews>
<IFrameURL>
http://www.amazon.com/reviews/iframe?
akid=[Your_AWSAccessKeyId]
&alinkCode=xm2
&asin=B004HFS6Z0
&atag=[Your_AssociateTag]
&exp=2011-06-01T22%3A32%3A53Z
&v=2
&sig=pxn6bbln%2B%2FVTPJdj8oCcXvjTHmo3spkUMjbQMPbhCKI%3D
</IFrameURL>
<HasReviews>true</HasReviews>
</CustomerReviews>
</Item>
you could then sort the responses if needed.

How do I get the correct taxes for a Shopify order from the API

I am receiving an order from the Shopify web-hook orders/create and
need to store the price and tax applicable for that order. I see some
settings in the Shopify preferences that allow me to set a sales tax
per delivery destination. Also Shopify allows me to optionally charge
taxes for shipping. I see the "taxes_included" property on the order
(which I take to mean that the price listed is either net or gross).
But it doesn't seem to specify if the shipping includes taxes. Is
there a way I can get this information from the API?
Here is the data that I'm passed in the web-hook call. I can do
further API calls to get the information if it is available, but can't
find it all in the documentation.
I have found the countries API, documented here:
http://api.shopify.com/country.html
So I should be able to look up the correct tax percent for the
line_items from the billing address province_code & country_code.
But I can't find anything telling me what tax should or shouldn't be
charged on shipping lines.
It would be more convenient if the tax was actually provided in the
data. It should also be more correct, since there is a chance (however
small) that the tax rates are changed in between me getting the
callback and making further requests for tax info. Is there a way to
get Shopify to provide that information in the web-hook?
Also, I have so far failed to get an data in the tax_lines property in
the data. Is there any hoop I need to jump through to get this?
An example of the data provided in the callback:
{"note":"",
"total_discounts":"0.00",
"cancel_reason":null,
"shipping_lines":
[{"code":"International Shipping",
"price":"25.00",
"source":"shopify",
"title":"International Shipping"}],
"landing_site_ref":null,
"discount_codes":[],
"currency":"CAD",
"buyer_accepts_marketing":true,
"customer":
{"last_order_name":null,
"note":null,
"last_name":"Test",
"state":"disabled",
"updated_at":"2012-11-20T08:05:07-05:00",
"last_order_id":null,
"orders_count":0,
"total_spent":"0.00",
"created_at":"2012-11-05T10:50:23-05:00",
"email":"test#example.com",
"first_name":"Test",
"accepts_marketing":true,
"id":101986160,
"tags":""},
"token":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"note_attributes":[],
"gateway":"bogus",
"cancelled_at":null,
"name":"#1025",
"processing_method":"direct",
"updated_at":"2012-11-20T08:05:07-05:00",
"payment_details":
{"avs_result_code":null,
"credit_card_bin":"1",
"cvv_result_code":null,
"credit_card_number":"XXXX-XXXX-XXXX-1",
"credit_card_company":"Bogus"},
"total_price":"44.00",
"shipping_address":
{"country":"United States",
"last_name":"Test",
"longitude":"-88.1632",
"name":"Test Test",
"address1":"Test",
"province":"Alabama",
"address2":"",
"latitude":"30.3891",
"city":"Test",
"phone":"",
"province_code":"AL",
"first_name":"Test",
"country_code":"US",
"zip":"36523",
"company":"Test"},
"line_items":
[{"variant_id":240781369,
"quantity":1,
"name":"product with stock code and shopify stock value",
"properties":[],
"title":"product with stock code and shopify stock value",
"product_id":104741307,
"variant_inventory_management":"shopify",
"fulfillment_service":"manual",
"sku":"some-stock-code",
"variant_title":null,
"requires_shipping":true,
"price":"19.00",
"vendor":"Shopify",
"id":243081982,
"grams":0,
"fulfillment_status":null}],
"closed_at":null,
"billing_address":
{"country":"United States",
"last_name":"Test",
"longitude":"-88.1632",
"name":"Test Test",
"address1":"Test",
"province":"Alabama",
"address2":"",
"latitude":"30.3891",
"city":"Test",
"phone":"",
"province_code":"AL",
"first_name":"Test",
"country_code":"US",
"zip":"36523",
"company":"Test"},
"order_number":1025,
"total_line_items_price":"19.00",
"total_tax":"0.00",
"tax_lines":[],
"created_at":"2012-11-20T08:05:07-05:00",
"landing_site":"\/",
"fulfillments":[],
"total_price_usd":"44.14",
"financial_status":"authorized",
"email":"test#example.com",
"browser_ip":"1.2.3.4",
"total_weight":0,
"referring_site":"",
"client_details":
{"accept_language":"en-US,en;q=0.8",
"browser_ip":"1.2.3.4",
"session_hash":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"user_agent":"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.1 (KHTML, like Gecko) Chrome\/21.0.1180.89 Safari\/537.1"},
"subtotal_price":"19.00",
"number":25,
"taxes_included":false,
"id":148179898,
"cart_token":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"fulfillment_status":null}
Assuming tax is charged on an order, all tax will appear in the tax lines array. You might have better luck using a real address in your tests. Try a famous US landmark or something.
If the shop is set up to charge tax on shipping, the amount will be included in the tax lines for the order. You can find out if the shop charges tax on shipping by looking at the Shop object.