question

improveyourlife avatar image
0 Likes"
improveyourlife asked ·

how can i create a simple search with item number

Hi I have been nudged in the ebay API direction to get results off a listed item, how can I do this just the get SHIPPING COST with the API... this is just one instance, I would like to get my head round it.
list by item number
· 4
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

What programming language are you thinking of implementing this in? If it's PHP I may be able to provide some example code.
0 Likes 0 ·
That would be great php is what im using, im using SIMPLE DOM for now
0 Likes 0 ·
Do you have an example item number that I could incorporate into some code? Do you wish to use the Trading service or a difference service such as the Finding or Shopping?
0 Likes 0 ·
Show more comments
clickimusprime avatar image
0 Likes"
clickimusprime answered ·
Procedural style: $appid = "yourappid"; $url = ' http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsAdvanced'; $url .= '&SERVICE-NAME=FindingService&SERVICE-VERSION=1.0.0&GLOBAL-ID=EBAY-US'; $url .= '&SECURITY-APPNAME=' . $appid . '&RESPONSE-DATA-FORMAT=XML'; $url .= '&categoryId=293'; $resp = file_get_contents($url); $xml = new SimpleXMLElement($resp); foreach($xml->searchResult->item as $item) { $itemid = (string) $item->itemId; $shipcost = (string) $item->shippingInfo->shippingServiceCost; echo $itemid . " " . $shipcost . "
\n"; } You build the URL following the format described in the docs. The url can be created on a single line, it's broken apart here for readability in forum limits. The itemid and shipping cost line reflect the structure of the XML. You can view the XML nicely formatted in Firefox by entering the same URL in the address bar. So you can prepare, edit, and test request URLs without coding then drop them into your code. Look for the available parameters and the "URL format" section in the docs. No XML is formatting required to place the call and the SimpleXMLElement converts the XML output to an object for easy access to the XML response. Trading API calls that require POST instead of GET are a bit more complicated, but this works well for Finding API. With this approach, you don't have to worry about an SDK going out of date when eBay makes changes, but you have to create the URL strings yourself. Once you have a basic understanding of the API features, it's less work than writing to an SDK.
·
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

improveyourlife avatar image
0 Likes"
improveyourlife answered ·
Yes, read that, few factors to take into account, thanks
·
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

clickimusprime avatar image
0 Likes"
clickimusprime answered ·
**I think im moving on then geet shot down... why does this return false for the item number I chose? $item->listingInfo->buyItNowAvailable** The documentation is there for a reason. http://developer.ebay.com/DevZone/finding/CallRef/findItemsAdvanced.html
·
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

improveyourlife avatar image
0 Likes"
improveyourlife answered ·
I think im moving on then geet shot down... why does this return false for the item number I chose? $item->listingInfo->buyItNowAvailable
· 1 ·
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

The item is a Fixed Price Listing and like it says in the [docs]( http://developer.ebay.com/DevZone/finding/CallRef/findItemsAdvanced.html#Response.searchResult.item.listingInfo.buyItNowAvailable) **Please ignore buyItNowAvailable for fixed-price listings.**
0 Likes 0 ·
improveyourlife avatar image
0 Likes"
improveyourlife answered ·
so this is all the info I can only get from the call? - Success 1.13.0 2016-06-14T09:16:49.786Z - - 201603135992 EBAY-GB - 112485 Shisha Pipes http://thumbs1.ebaystatic.com/m/m_5HQytDPgq85MPGIjrQfUw/140.jpg http://www.ebay.co.uk/itm/Kangertech-NEBOX-KANGER-Tech-60W-TC-Starter-Kit-UK-SELLER-/201603135992 PayPal false WN69JT Wigan,United Kingdom GB - 4.51 Flat GB - 29.95 29.95 Active P29DT2H33M34S + - 1000 New false false - 1 100 1 1 http://www.ebay.co.uk/sch/i.html?_nkw=201603135992&_ddo=1&_ipg=100&_pgn=1
·
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

improveyourlife avatar image
0 Likes"
improveyourlife answered ·
I see. david... yes just changed and bingo... > 201603135992 title is - Kangertech NEBOX KANGER Tech 60W TC Starter Kit, UK SELLER price is - shipping is - 4.51 < ive been looking at those methods and if I need the following and unitPrice returns nothing? if I need to get 1. List item id 2. Description 3. Title 4. Price 5. Shipping etc am I using the correct OPERATION-NAME
· 2 ·
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

and it is possible to get the image?
0 Likes 0 ·
The documentation will tell what information is available in the response. http://developer.ebay.com/DevZone/finding/CallRef/findItemsAdvanced.html#Output And don't forget that you can copy the URL into a browser and look at the output to see what is returned.
0 Likes 0 ·
improveyourlife avatar image
0 Likes"
improveyourlife answered ·
· 2 ·
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

152099906802 title is - Official Harry Potter Pets Plush Toys Teddy Phoenix Owl Rat Gift Fawkes Hedwig 5.71
0 Likes 0 ·
A URL for searching the **UK** site for the item 201603135992 http://svcs.ebay.com/services/search/FindingService/v1? SECURITY-APPNAME= &OPERATION-NAME=findItemsAdvanced &SERVICE-VERSION=1.13.0 &GLOBAL-ID=EBAY-GB &RESPONSE-DATA-FORMAT=XML &REST-PAYLOAD &keywords=201603135992 http://svcs.ebay.com/services/search/FindingService/v1?SECURITY-APPNAME=&OPERATION-NAME=findItemsAdvanced&SERVICE-VERSION=1.13.0&GLOBAL-ID=EBAY-GB&RESPONSE-DATA-FORMAT=XML&REST-PAYLOAD&keywords=201603135992
0 Likes 0 ·
improveyourlife avatar image
0 Likes"
improveyourlife answered ·
Ok, if I change the OPERATION-NAME to FindItemsByKeywords I get an error on the foreach line with categoryid=293 Warning: Invalid argument supplied for foreach()
· 2 ·
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

improveyourlife avatar image
0 Likes"
improveyourlife answered ·
mmmm... I changed to $url .='&keywords=201603135992'; and now I get nothing... that item number is this http://www.ebay.co.uk/itm/Kangertech-NEBOX-KANGER-Tech-60W-TC-Starter-Kit-UK-SELLER-/201603135992?ssPageName=STRK:MESE:IT
· 1 ·
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

The item won't be found because you are searching the ebay.com site where the item is not available. Remember that the finding api is designed for buyers and works in the same way as searching eBay itself. Because 201603135992 is listed on the UK site you need to change the site that you are searching from `GLOBAL-ID=EBAY-US` to `GLOBAL-ID=EBAY-GB`
0 Likes 0 ·
clickimusprime avatar image
0 Likes"
clickimusprime answered ·
**Super thanks, i suppose that foreach statement will have to change if i only need data off one item?** No. You can, but it will work regardless of the qty returned. **Last one, if I incorporate a form to search for attributes by itemid does the url change, if so to what? I noticed im getting results by categoryId=293** You need to customize the URL to suit your needs. findItemsAdvanced has the widest range of features. In this case, you would remove the categoryId parameter and use keywords=ITEMID as David indicated. Likewise any other mods. You might also consider using GetSingleItem or GetMultipleItems from the Shopping API. They provide more details and can retrieve closed items too. The PHP technique is the same, but the URL and response formats are different.
·
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.