question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Product Services:UpdateAsync - (400 Bad Request) Write requests to inventory_quantity and inventory_quantity_adjustment are no longer supported.

See original GitHub issue

Loading the product using GetAsync, Product product = await productService.GetAsync((long)apiCall.Product.Id); product.Tags = newTags; product = await productService.UpdateAsync((long)product.Id, product);

calling the UpdateAsync gives below error, (400 Bad Request) Write requests to inventory_quantity and inventory_quantity_adjustment are no longer supported. Please use the Inventory Levels API.

Stack trace: at ShopifySharp.ShopifyService.CheckResponseExceptions(HttpResponseMessage response, String rawResponse) at ShopifySharp.ShopifyService.<>c__DisplayClass26_01.<<ExecuteRequestAsync>b__0>d.MoveNext() — End of stack trace from previous location where exception was thrown — at ShopifySharp.DefaultRequestExecutionPolicy.Run[T](CloneableRequestMessage request, ExecuteRequestAsync1 executeRequestAsync) at ShopifySharp.ShopifyService.ExecuteRequestAsync[T](RequestUri uri, HttpMethod method, HttpContent content, String rootElement) at ShopifySharp.ProductService.UpdateAsync(Int64 productId, Product product)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
nozzlegearcommented, Mar 19, 2020

@madushann It’s possible that it could mess up some product data, since many of the properties you don’t set would be serialized as null. That’s why @mark-jeanswhse is using PublishedAt = ... – if that one is accidentally set to null, it will unpublish your product.

You should also be able to just set the InventoryQuantity property to null before you update the product, and that should get it working again.

var product = await productService.GetAsync(productId);

product.Tags = newTags;
product.InventoryQuantity = null;

product = await productService.UpdateAsync(productId, product);

I’m going to publish an update to the ProductService that will automatically do this behind the scenes for each update call, as I’ve had a handful of questions and emails about this error. It’s too easy for us to accidentally shoot ourselves in the foot when trying to update products thanks to the property deprecation.

0reactions
madushanncommented, Mar 20, 2020

@nozzlegear

I’m going to publish an update to the ProductService that will automatically do this behind the scenes for each update call, as I’ve had a handful of questions and emails about this error. It’s too easy for us to accidentally shoot ourselves in the foot when trying to update products thanks to the property deprecation.

Hope, Once you push the update will be available straight forward with newer version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix a 400 Bad Request Error (Causes and Fixes)
The 400 Bad Request error indicates that the server cannot or process the request due to a client error. Read about the common...
Read more >
the remote server returned an error .(400 bad request)
It means that the request itself has somehow incorrect or corrupted and the server couldn't understand it. The server is refusing to service...
Read more >
Why should '400 Bad Request' not be repeated without a ...
A “bad request” means your request is not acceptable to the server. Feel free to repeat it 100 times, but it will always...
Read more >
How to Fix a 400 Bad Request Error: 8 Easy Methods
Most HTTP error 400 bad requests are caused by malformed request syntax, invalid request message framing, or deceptive request routing.
Read more >
HTTP Error 400 Bad Request: What It Is and How to Fix It
The HTTP error 400 Bad Request is a client-side error that can happen when you visit a website. Learn more about the common...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found