A fully-typed TypeScript client for the Tradera SOAP API. This package provides easy-to-use clients for Tradera's services, with auto-generated TypeScript types and client bindings.
- đź”’ Fully typed - Complete TypeScript definitions for all API methods and responses
- ⚡ Async/await support - All API methods return Promises
- 🛠️ IntelliSense support - Full autocomplete in VS Code and other TypeScript-aware editors
- 🌳 Tree-shakeable - Import only what you need
- 🔄 Auto-generated - Client code is generated directly from Tradera's WSDL definitions
npm install tradera-soap-api-clientor if you use yarn
yarn add tradera-soap-api-clientUse TraderaSearchClient for searching items on Tradera:
import { TraderaSearchClient } from 'tradera-soap-api-client';
const searchClient = new TraderaSearchClient({
appId: YOUR_APP_ID,
appKey: "YOUR_APP_KEY"
});
// Basic search
const result = await searchClient.search({
query: "vintage",
categoryId: 0
});
console.log(result.SearchResult?.Items);
console.log(result.SearchResult?.TotalNumberOfItems);
// Advanced search with filters
const advancedResult = await searchClient.searchAdvanced({
query: "retro",
categoryId: 0,
pageNumber: 1,
itemsPerPage: 50,
orderBy: "EndDateAscending"
});
// Search by zip code
const localResult = await searchClient.searchByZipCode({
zipCode: "11122",
distance: 10,
categoryId: 0
});Use TraderaPublicClient for accessing item details, user information, categories, and more:
import { TraderaPublicClient } from 'tradera-soap-api-client';
const publicClient = new TraderaPublicClient({
appId: YOUR_APP_ID,
appKey: "YOUR_APP_KEY"
});
// Get item details
const item = await publicClient.getItem({ itemId: 123456789 });
console.log(item.GetItemResult?.Title);
console.log(item.GetItemResult?.CurrentBid);
// Get all categories
const categories = await publicClient.getCategories({});
console.log(categories.GetCategoriesResult?.Categories);
// Get user information
const user = await publicClient.getUserByAlias({ alias: "username" });
console.log(user.GetUserByAliasResult?.TotalRating);
// Get seller's items
const sellerItems = await publicClient.getSellerItems({ sellerId: 12345 });
console.log(sellerItems.GetSellerItemsResult?.Items);
// Get user feedback
const feedback = await publicClient.getFeedback({ userId: 12345 });
console.log(feedback.GetFeedbackResult?.Feedbacks);
// Get official Tradera time (for auction endings)
const time = await publicClient.getOfficalTime({});
console.log(time.GetOfficalTimeResult);For more control, you can use the generated SOAP client directly:
import { createClientAsync } from './src/generated/search/client.js';
async function searchTradera() {
const wsdlUrl = "http://api.tradera.com/v3/SearchService.asmx?WSDL";
const client = await createClientAsync(wsdlUrl);
// Add required Tradera authentication headers
client.addSoapHeader({
AuthenticationHeader: {
AppId: YOUR_APP_ID,
AppKey: "YOUR_APP_KEY"
}
}, '', 'tns', 'http://api.tradera.com');
// Search for items
const result = await client.SearchAsync({
query: "vintage",
categoryId: 0
});
console.log(result.SearchResult?.Items);
console.log(result.SearchResult?.TotalNumberOfItems);
}| Method | Description | Documentation |
|---|---|---|
search |
Search for items | Search |
searchAdvanced |
Advanced search with filters | SearchAdvanced |
searchCategoryCount |
Get category counts for search | SearchCategoryCount |
searchByFixedCriteria |
Search with fixed criteria lists | SearchByFixedCriteria |
searchByZipCode |
Search items near a zip code | SearchByZipCode |
| Method | Description | Documentation |
|---|---|---|
getItem |
Get details for a specific item | GetItem |
getSellerItems |
Get items from a specific seller | GetSellerItems |
getSellerItemsQuickInfo |
Get minimal item info (useful for new items) | GetSellerItemsQuickInfo |
getUserByAlias |
Get user information by alias | GetUserByAlias |
fetchToken |
Fetch authorization token | FetchToken |
getOfficalTime |
Get official Tradera time | GetOfficalTime |
getCategories |
Get category hierarchy | GetCategories |
getAttributeDefinitions |
Get attribute definitions for a category | GetAttributeDefinitions |
getAcceptedBidderTypes |
Get accepted bidder types | GetAcceptedBidderTypes |
getExpoItemTypes |
Get expo item types with prices | GetExpoItemTypes |
getItemTypes |
Get available item types | GetItemTypes |
getCounties |
Get list of counties for search | GetCounties |
getItemFieldValues |
Get available item field values | GetItemFieldValues |
getItemAddedDescriptions |
Get added descriptions for an item | GetItemAddedDescriptions |
getFeedback |
Get user feedback | GetFeedback |
getFeedbackSummary |
Get user feedback summary | GetFeedbackSummary |
getShippingOptions |
Get shipping options for countries | GetShippingOptions |
| Method | Description | Use Instead |
|---|---|---|
getSearchResult |
Search for items | TraderaSearchClient.search |
getSearchResultAdvanced |
Advanced search | TraderaSearchClient.searchAdvanced |
getSearchResultAdvancedXml |
XML-based search | TraderaSearchClient.searchAdvanced |
getPaymentTypes |
Get payment types | getItemFieldValues |
getShippingTypes |
Get shipping types | getItemFieldValues |
npm run buildCompiles TypeScript to JavaScript in the dist/ folder.
npm run generate-clientRegenerates the TypeScript client from Tradera's WSDL definitions. This fetches the latest WSDL from:
http://api.tradera.com/v3/SearchService.asmx?WSDLhttp://api.tradera.com/v3/PublicService.asmx?WSDL
To use the Tradera API, you need to register for API credentials at Tradera's developer portal. You will receive:
- AppId - Your application ID (number)
- AppKey - Your application key (GUID string)
These are automatically included in SOAP headers when using the wrapper clients.
Some services require user impersonation in addition to app credentials. This means you need to provide the Tradera user's ID and authorization token:
TraderaRestrictedClient- For managing items, transactions, and shop settingsTraderaOrderClient- For managing orders
const client = new TraderaRestrictedClient({
appId: YOUR_APP_ID,
appKey: "YOUR_APP_KEY",
userId: 12345, // Tradera user ID
token: "USER_TOKEN" // Authorization token
});To obtain a user token, use the fetchToken method from TraderaPublicClient:
import { TraderaPublicClient } from 'tradera-soap-api-client';
const publicClient = new TraderaPublicClient({
appId: YOUR_APP_ID,
appKey: "YOUR_APP_KEY"
});
const tokenResponse = await publicClient.fetchToken({
userName: "trader-username",
password: "trader-password"
});
console.log(tokenResponse.FetchTokenResult); // The auth tokenThis package supports tree shaking. You can import only what you need:
// Import only the search client
import { TraderaSearchClient } from 'tradera-soap-api-client';
// Or import types directly from subpaths
import { Search } from 'tradera-soap-api-client/search';
import { Public } from 'tradera-soap-api-client/public';- soap - SOAP client for Node.js
- wsdl-tsclient - TypeScript client generator from WSDL
MIT