如何显示来自 Woocomerce Api 调用的数据? [英] How to display data from Woocomerce Api call?
本文介绍了如何显示来自 Woocomerce Api 调用的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有从 woocomerce 下载数据的 UWP 应用.
I have UWP app which downloads data from woocomerce.
RestAPI rest = new RestAPI("http://simplegames.com.ua/wp-json/wc/v1/", "ck_9d64c027d2c5f81b8bed3342eeccc6d337be813d", "cs_60697b1e6cbdeb8d62d19e0765e339f8e3334754");
WCObject wc = new WCObject(rest);
//Get all products
var products = await wc.GetOrders();
Debug.WriteLine(products);
我尝试向控制台显示数据.
I try to display data to Console.
Debug 显示方法名称,如何显示我下载的数据?
Debug shows name of method, how I can show data that I downloaded?
推荐答案
那么,让我们开始
//Get all products
var products = await wc.GetOrders();
您检索从 List
派生的 OrderList
对象类型.这意味着,您需要获取每个项目的数据
You retrieve OrderList
object type, which derives from List<Order>
. It means, that you need get data per each item
foreach (var order in products)
{
}
在 order
项目中,您拥有您需要的所有必需数据.例如:
In order
item you have all required data, which you need. For example:
Debug.WriteLine($"Currency: {order.currency}, Total Tax: {order.total_tax}");
我希望你能找到如何从 order
item
I hope, you will find way how retrieve other data from order
item
这篇关于如何显示来自 Woocomerce Api 调用的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文