Tradera.com logotype

Tradera Developer Program

Code samples for calling the API GetItem method from PHP5 and Classic ASP.

PHP5

PHP needs to to have the SOAP extension enabled and available.

The following functions have PHP code examples on their respective documentation page:

  • FetchToken Used to retrieve a token for a user.
  • AddItem Add an auction or buy it now item.
  • AddShopItem Used for adding shop items.
  • GetRequestResults Needed to confirm the result of some requests (AddItem, AddShopItem, RemoveShopItem, UpdateShopItem, SetPriceOnShopItems).
  • RemoveShopItem Removes a shop item (sets its end date to a time in the past).
  • UpdateShopItem Update any parts of an item. Non null values will replace the old ones.
  • SetQuantityOnShopItems Can be used to set the quantity on many shop items at once.
  • SetPriceOnShopItems Can be used to set the price on many shop items at once.
  • GetSellerOrders Used to get orders for the seller whose credentials are used.
  • SetSellerOrderAsShipped Marks the order as shipped. This is mandatory for orders with Klarna payments. Setting the order as shipped is what notifies Klarna that the payment should be made.
  • GetSellerItems Gets items for the seller
  • GetItemFieldValues

Classic ASP

  1:
  2:
  3:
  4:
  5:
  6:
  7:
  8:
  9:
 10:
 11:
 12:
 13:
 14:
 15:
 16:
 17:
 18:
 19:
 20:
 21:
 22:
 23:
 24:
 25:
 26:
 27:
 28:
 29:
 30:
 31:
 32:
 33:
 34:
 35:
 36:
 37:
 38:
 39:
 40:
 41:
 42:
 43:
 44:
 45:
 46:
 47:
 48:
 49:
 50:
 51:
 52:
 53:
 54:
 55:
 56:
 57:
 58:
 59:
 60:
 61:
 62:
<%

	Dim itemId

	' Use some active auction's Id
	' (for example, one of the Guldkorn
	' auctions from the Tradera.com mainpage)
	itemId = 0

	Dim httpRequest
	Set httpRequest = CreateObject("MSXML2.XMLHTTP")

	'Create the SOAP Envelope, check the example page for each method
	' (for instance https://api.tradera.com/v3/PublicService.asmx?op=GetItem)
	Dim soapEnvelope
	soapEnvelope = _
	"<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
	"  <soap:Body>" & _
	"    <GetItem xmlns=""https://api.tradera.com"">" & _
	"      <itemId>" & itemId &  "</itemId>" & _
	"    </GetItem>" & _
	"  </soap:Body>" & _
	"</soap:Envelope>"


	Dim applicationId, applicationKey

	' This should be your application Id
	applicationId = yourApplicationId

	' This should be your application key
	applicationKey = "yourApplicationKey"

	httpRequest.Open "POST", "https://api.tradera.com/v3/PublicService.asmx?appId=" & applicationId & "&appKey=" & applicationKey, False
	httpRequest.SetRequestHeader "Content-Type", "text/xml"

	' Set a header for the method to be called
	httpRequest.SetRequestHeader "SOAPAction", "https://api.tradera.com/GetItem"

	' Make the SOAP call
	httpRequest.send soapEnvelope

	If httpRequest.Status = 200 Then

		' Create XML document from response
		Dim xmlDoc
		Set xmlDoc = CreateObject("Microsoft.XMLDOM")
		xmlDoc.load(httpRequest.responseBody)

		' Select the long description into an XML node
		Dim longDescriptionNode
		Set longDescriptionNode = xmlDoc.selectSingleNode("//LongDescription")

		' Write out the long description
		Response.Write "<h1>Long description for item #" & itemId & "</h1><pre>" & longDescriptionNode.Text & "</pre>"

	Else
		Response.Write "<h1>Status</h1><p>" & httpRequest.Status & " (" & httpRequest.StatusText & ")</p>"

	End If

%>

Remarks

  • Get an active auction's Id from the Tradera.com site to use on line 08.
  • You must replace yourAppId and yourAppServiceKey with your own application Id and application service key on line 29 and 32.

XHTML CSS