我有一个针对GetOrders的eBay Trading API的API调用。获得数据后,我需要返回它,并为不同的系统创建自定义XML文档。
我想得到的是每个订单的任何输出
<Order>
<OrderNumber>123456789</OrderNumber>
<OrderDate>2-Jul-2014 14:25:33</OrderDate>
<Billing>
<FullName>Full name</FullName>
<Email>some@email.com</Email>
<Phone>777-123-1234</Phone>
<Address>
<Street1>123 main sr</Street1>
<City>Hillsville</City>
<State>VA</State>
<Code>24343</Code>
<Country>US</Country>
</Address>
</Billing>
</Order>
这是我现在的api电话。
using System;
using System.Web.Http;
using System.Xml;
using System.Xml.Linq;
using eBay.Service.Call;
using eBay.Service.Core.Sdk;
using eBay.Service.Core.Soap;
namespace SellerChain.Areas.eBayAPI.Controllers
{
public class GetOrdersController : ApiController
{
public object Get()
{
var apiContext = token.ApiContext();
var timeFilter = new TimeFilter
{
TimeFrom = Convert.ToDateTime("2014-07-01T16:15:34.868Z"),
TimeTo = DateTime.UtcNow
};
const OrderStatusCodeType orderStatus = OrderStatusCodeType.Completed;
const TradingRoleCodeType orderRole = TradingRoleCodeType.Seller;
var apiCall = new GetOrdersCall(apiContext)
{
DetailLevelList = new DetailLevelCodeTypeCollection
{
DetailLevelCodeType.ReturnSummary
},
Pagination = new PaginationType
{
EntriesPerPage = 10,
PageNumber = 1,
},
IncludeFinalValueFee = true,
CreateTimeFilter = timeFilter,
OrderStatus = orderStatus,
OrderRole = orderRole,
};
apiCall.GetOrders(
timeFilter,
(TradingRoleCodeType)Enum.Parse(typeof(TradingRoleCodeType), orderRole.ToString()),
(OrderStatusCodeType)Enum.Parse(typeof(OrderStatusCodeType), orderStatus.ToString())
);
return apiCall;
}
}
}
答案 0 :(得分:0)
试试这个
var doc = new XDocument(
new XElement("SEITOrders",
from o in apiCall.ApiResponse.OrderArray.ToArray()
select
new XElement("order",
new XElement("orderID", o.OrderID))));