Returning auctions ending later than 10 days

2019-01-08 01:45发布

My api/xml is working fine with returning auctions ending from present until 10 days but is not working for listings ending after 10 days:

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

Here is how I am downloading results:

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();
}

标签: c# xml ebay-api
2条回答
Evening l夕情丶
2楼-- · 2019-01-08 01:58

I am not really sure what is your problem, I tried the same API with the time difference less than 10 days and more than 10 days.

Less than 10 days

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

More than 10 days

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

Try it out, it should work.

PS: For me. both of your statements don't work, I get this:

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

Update:

eBay does not allow any auctions to last more than 10 days. So, if you try to find an auction from: 8/24 to 8/30, where current date us: 8/08, you will not find anything. Because if an auction is listed today, at max, a seller can put it up for sale is till 08/18.

Replace AuctionWithBIN with StoreInventory to get results from stores which has listings more than 10 days.

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-01-08 02:11

According to the eBay DevZone Finding API Call Reference ItemFilterType documentation for EndTimeTo, there is no stated/published limit on EndTimeTo:

EndTimeTo Limits the results to items ending on or before the specified time.

Specify a time in the future.

Allowed values (dateTime):

Specify the time in GMT.

Can you publish your C# code creating this URL?


Your first URL params are: Year 11, Month 8, Date 10

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

Your second URL params are: Year 11, Month 20, Date 10

EndTimeTo&itemFilter(5).value=11-20-10T07:52:48.000Z
查看更多
登录 后发表回答