SWS GetAuctions Method
Retrieves details about each auction for a given site.
Parameters
Name | DataType | Is Required |
---|---|---|
SiteID | Long | Required |
Description | The site’s ID number. This can be found using the GetSiteList method. | |
Status | String | Optional |
Description | The auction’s status based on the AuctionStatusValues enum. If not selected, it will default to ‘SCHEDULED’. Available values:
|
Returned Parameters
Name | DataType |
---|---|
AUCTION_DATE | DateTime |
Description | The date and time of the auction. |
AUCTION_ID | Long |
Description | The auction’s ID number. |
AUCTION_TIME | String |
Description | The formatted time of the auction. |
AUCTIONEER_NAME | String |
Description | The auctioneer’s name. Max string length of 100. |
FORMAT_DATE | String |
Description | The formatted date of the auction. |
SITE_ID | Long |
Description | The site’s ID number. |
STATUS | Integer |
Description | The auction’s status. Available values:
|
STATUS_VALUE | String |
Description | The status value of the auction status. Available values:
|
Example
As with every method we need to pass in credentials. We do this with the LookupUser request object.
We’ll assume you’ve got a web reference, let’s name it SWS, in your Visual Studio project. At this point we need to our objects. We’ll need the standard service object, a GetAuctions request object and a GetAuctions response object. We can define and create those like this:
// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.GetAuctions_Request request = new SWS.GetAuctions_Request();
SWS.GetAuctions_Response response;
Here’s my sample code of the Request object.
// GetAuctions Request
request.SiteID = 123456;
request.Status = new SWS.AuctionStatusValues[] { SWS.AuctionStatusValues.SCHEDULED };
Finally we can call the method and pass across the login object and the request object to get our auction details. It’s a good idea to do this in a Try Catch block.
// Call the method that will load the response object
try
{
response = service.GetAuctions(user_request,request);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Note that if something goes wrong the service will respond with an exception. You’ll want to take a look at that message returned in that exception so it can be debugged.
For a full list of methods see SWS Methods.
Updated May 25, 2016: Previously this function would only return results for one of the auction status types, if more than one type was passed in.The function now returns results for each status type passed in.