Comments (6)
@robodoginc I just tried reading some product metafield with that method in my application and it's working. Can you provide source code or try to debug it yourself?
Also as additional debugging routine I personally use - is to make exact same calls in Postman (popular REST testing app) as you do with this library (essentially it's all that this library do - making API calls, but with very useful models).
from shopifysharp.
@oleksii-vynnychenko Below is the source code that is failing for testing.
var shopProductService = new ShopifyProductService(myShopifyUrl, shopAccessToken);
var shopMetaService = new ShopifyMetaFieldService(myShopifyUrl, shopAccessToken);
using (dbEntities db = new dbEntities())
{
foreach (SaleItemShopifyProduct oSaleItemShopifyProduct in db.SaleItemShopifyProducts)
{
var metafields = await shopMetaService.ListAsync(oSaleItemShopifyProduct.Id, "products");
foreach (SaleItemShopifyMetaField oSaleItemShopifyMetaField in oSaleItemShopifyProduct.SaleItemShopifyMetaFields)
{
long metaId = oSaleItemShopifyMetaField.Id;
var sMeta1 = await shopMetaService.GetAsync(metaId);
var sMeta = metafields.Where(q => q.Id == metaId).FirstOrDefault();
}
}
}
The code is looping through values stored in the database. When I load metafields (based upon the productId), it loads all related meta fields properly.
The metaId is the value returned from Shopify. The .GetAsync
for sMeta1
is null, but the same Id in the loaded list, it finds and returns the object sMeta
properly. I am using the same service for the MetaFields, therefore it should not be a connection issue, as other tasks through the same service (ListAsync
and UpdateAsync
are functioning properly, but GetAsync
returns null).
from shopifysharp.
Thanks for reporting this! I've been super busy over the past couple of weeks and haven't had a chance to look into this yet, but I'll get on it as soon as possible.
from shopifysharp.
@robodoginc Ah, sorry... you're right.
Problem, I guess is that response is not Metafield object, but {"metafield": <metafield object>}
so Json.NET can't deserialize it, so it returns null
.
from shopifysharp.
Turns out it was a problem right here, where the service was expecting "metafields": {...}"
but should have been "metafield"
. It wasn't caught by the tests because .GetAsync()
was the one metafield test that somehow wasn't in the metafield test playlist.
Thanks again for opening this issue. The fix should be available on Nuget with ShopifySharp v3.1.1.
from shopifysharp.
My apologies. I missed that when I submitted that service. Thanks for sorting it.
from shopifysharp.
Related Issues (20)
- Retrieving Product category field HOT 1
- CloneableRequestMessage can fail to clone content and then throw an ObjectDisposedException
- [Suggestion] Generic IServiceFactory to reduce repetitive code HOT 3
- Refactor the CloneableRequestMessage
- ShopifyOauthUtility.RefreshAccessTokenAsync incorrectly disposes the static HttpClient used by InternalHttpClientFactory
- SendAsync methods are missing on the IGraphService interface
- New product model - deprecated REST endpoints HOT 8
- Regarding the Dispute of Shopify Payment HOT 1
- System.Text.Json, Version=7.0.0.0 reference problem HOT 11
- App crashes silently using version 5.19.0 HOT 2
- Split readme documentation into Wiki Docs HOT 2
- How to use an offline token? HOT 2
- How can I get the 'current_quantity' of 'line_items' from Order HOT 3
- Is there any way to use ShopifySharp to create Theme App Extensions HOT 3
- Create metafield definitions to be used with smart collections HOT 2
- Using Leaky bucket and still throttled ! HOT 1
- How To Create a Draft Order with Subscription in it? HOT 2
- Why does the function ListAsync() of CollectionListingService return 404? HOT 5
- Authentication/Authorization doc needs updated
- IsValidShopDomainAsync should check if X-ShopId header has a value HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shopifysharp.