Giter Site home page Giter Site logo

Comments (6)

 avatar commented on May 8, 2024

@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.

robodoginc avatar robodoginc commented on May 8, 2024

@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 sMeta1is null, but the same Id in the loaded list, it finds and returns the object sMetaproperly. I am using the same service for the MetaFields, therefore it should not be a connection issue, as other tasks through the same service (ListAsyncand UpdateAsync are functioning properly, but GetAsync returns null).

from shopifysharp.

nozzlegear avatar nozzlegear commented on May 8, 2024

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.

 avatar commented on May 8, 2024

@robodoginc Ah, sorry... you're right.
image

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.

nozzlegear avatar nozzlegear commented on May 8, 2024

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.

darkstar74 avatar darkstar74 commented on May 8, 2024

My apologies. I missed that when I submitted that service. Thanks for sorting it.

from shopifysharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.