返回拍卖结束晚于10天

时间:2011-08-03 15:43:22

标签: c# xml ebay-api

我的api / xml工作正常,返回拍卖从现在到10天结束,但不适用于10天后结束的商品:

http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByCategory&SERVICE-VERSION=1.11.0&SECURITY-APPNAME=AlexGo:::::::hiddin::::821eee8&RESPONSE-DATA-FORMAT=XML&categoryId=307&paginationInput.entriesPerPage=100&paginationInput.pageNumber=1&outputSelector=CategoryHistogram&sortOrder=EndTime&itemFilter(0).name=MinPrice&itemFilter(0).value=.01&itemFilter(1).name=MaxPrice&itemFilter(1).value=1000&itemFilter(2).name=ListingType&itemFilter(2).value=AuctionWithBIN&itemFilter(3).name=LocatedIn&itemFilter(3).value=US&itemFilter(4).name=EndTimeFrom&itemFilter(4).value=2011-08-24T10:23:00.000Z&itemFilter(5).name=EndTimeTo&itemFilter(5).value=2011-08-31T10:23:00.000Z

以下是我下载结果的方式:

public string DownLoad(string url)
{
    // used to build entire input
    StringBuilder sb = new StringBuilder();

    // used on each read operation
    byte[] buf = new byte[32768];
    try
    {
        // prepare the web page we will be asking for
        HttpWebRequest request = (HttpWebRequest)
            WebRequest.Create(url);

        // execute the request
        HttpWebResponse response = (HttpWebResponse)
            request.GetResponse();

        // we will read data via the response stream
        Stream resStream = response.GetResponseStream();
        string tempString = null;
        int count = 0;

        do
        {
            // fill the buffer with data
            count = resStream.Read(buf, 0, buf.Length);

            // make sure we read some data
            if (count != 0)
            {
                // translate from bytes to ASCII text
                tempString = Encoding.ASCII.GetString(buf, 0, count);

                // continue building the string
                sb.Append(tempString);
            }
        }
        while (count > 0); // any more data to read?
    }
    catch (Exception)
    {

        timer1.Enabled = false;
        progressBar1.Visible = false;
        msg.ForeColor = Color.Red;
        msg.Text = "Please try after some time !!!";
        msg.Visible = true;
    }
    // print out page source
    // MessageBox.Show(sb.ToString());
    return sb.ToString();
}

2 个答案:

答案 0 :(得分:2)

根据eBay DevZone Finding API Call Reference ItemFilterType documentation for EndTimeTo,EndTimeTo没有声明/发布限制:

  

EndTimeTo将结果限制为在指定时间或之前结束的项目。

     

指定将来的时间。

     

允许值(dateTime):

     

以GMT指定时间。

您可以发布创建此网址的C#代码吗?


您的第一个网址参数是:第11年,第8个月,第10天

EndTimeTo&itemFilter(5).value=11-08-10T07:52:48.000Z

您的第二个网址参数是:第11年,第20个月,第10天

EndTimeTo&itemFilter(5).value=11-20-10T07:52:48.000Z

答案 1 :(得分:2)

我不确定你的问题是什么,我尝试使用时间差小于10天且超过10天的相同API。

少于10天

http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByCategory
&SERVICE-VERSION=1.11.0
&SECURITY-APPNAME=ENTER-APP-ID-HERE
&RESPONSE-DATA-FORMAT=XML
&categoryId=307
&paginationInput.entriesPerPage=100
&paginationInput.pageNumber=1
&outputSelector=CategoryHistogram&sortOrder=EndTime&itemFilter%280%29.name=MinPrice&itemFilter%280%29.value=0.01&itemFilter%281%29.name=MaxPrice&itemFilter%281%29.value=10000
&itemFilter%282%29.name=ListingType&itemFilter%282%29.value=AuctionWithBIN&itemFilter%283%29.name=LocatedIn&itemFilter%283%29.value=US
&itemFilter%284%29.name=EndTimeFrom&itemFilter%284%29.value=2011-08-06T07:52:48.000Z
&itemFilter%285%29.name=EndTimeTo&itemFilter%285%29.value=2011-08-10T07:52:48.000Z

超过10天

http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByCategory
&SERVICE-VERSION=1.11.0
&SECURITY-APPNAME=ENTER-APP-ID-HERE
&RESPONSE-DATA-FORMAT=XML
&categoryId=307
&paginationInput.entriesPerPage=100
&paginationInput.pageNumber=1
&outputSelector=CategoryHistogram&sortOrder=EndTime&itemFilter%280%29.name=MinPrice&itemFilter%280%29.value=0.01&itemFilter%281%29.name=MaxPrice&itemFilter%281%29.value=10000
&itemFilter%282%29.name=ListingType&itemFilter%282%29.value=AuctionWithBIN&itemFilter%283%29.name=LocatedIn&itemFilter%283%29.value=US
&itemFilter%284%29.name=EndTimeFrom&itemFilter%284%29.value=2011-08-06T07:52:48.000Z
&itemFilter%285%29.name=EndTimeTo&itemFilter%285%29.value=2011-08-30T07:52:48.000Z

尝试一下,它应该有效。

PS:对我来说。你的两个陈述都不起作用,我明白了:

<findItemsByCategoryResponse><ack>Failure</ack><errorMessage><error><errorId>12</errorId><domain>Marketplace</domain><severity>Error</severity><category>Request</category><message>Invalid date/time value.</message><subdomain>Search</subdomain><parameter>END_TIME_FROM</parameter></error><error><errorId>12</errorId><domain>Marketplace</domain><severity>Error</severity><category>Request</category><message>Invalid date/time value.</message><subdomain>Search</subdomain><parameter>END_TIME_TO</parameter></error></errorMessage><version>1.11.0</version><timestamp>2011-08-06T00:28:25.501Z</timestamp></findItemsByCategoryResponse>

<强>更新

eBay不允许任何拍卖持续超过10天。因此,如果您尝试从8/24到8/30进行拍卖,当前日期为8月8日,您将找不到任何内容。因为如果今天列出拍卖,最多,卖家可以把它出售到08/18。

AuctionWithBIN替换为StoreInventory,以便从列表超过10天的商店中获取结果。