question

bluearmy78 avatar image
0 Likes"
bluearmy78 asked

Complex aspect searches with spaces

I'm using "aspects" to find items but I'm having trouble finding them when spaces are used in the filtering. In the example below, I'd like to retrieve Honda cars that have a mileage less that 10000miles. To be honest, any query isn't working for me if it includes spaces. It's working fine looking for Coupes or Red cars, but anything with a space in the filter or search and it breaks. I've tried urlencoding which didn't work, and using ". http://svcs.ebay.com/services/search/FindingService/v1?SECURITY-APPNAME=xxx&OPERATION-NAME=findItemsAdvanced&SERVICE-VERSION=1.13.0&GLOBAL-ID=EBAY-GB&RESPONSE-DATA-FORMAT=JSON&REST-PAYLOAD&categoryId=18206&outputSelector=AspectHistogram&keywords=&aspectFilter(0).aspectName="Vehicle_Mileage"&aspectFilter(0).aspectValueName="Less than 10,000 miles"
advanced search
· 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.

xiang.developersupport avatar image
0 Likes"
xiang.developersupport answered
Hi @bluearmy78, Please refer to the document: https://developer.ebay.com/Devzone/finding/Concepts/MakingACall.html ... URL Encoding for String Values Best Regards,
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.

bluearmy78 avatar image
0 Likes"
bluearmy78 answered
Thanks for the reply @xiang.developersupport . I have read that document and have url encoded my requests as I put in my question. I'm tearing my hair out as many queries are not working as they should. I'm using the excellent AspectHistogram in order to build up a list of aspects to search from, but many are coming back with 0 results even though the histogram says there are hundreds available. Using http://svcs.ebay.com/services/search/FindingService/v1?SECURITY-APPNAME=XXX&OPERATION-NAME=findItemsAdvanced&SERVICE-VERSION=1.13.0&GLOBAL-ID=EBAY-GB&RESPONSE-DATA-FORMAT=JSON&REST-PAYLOAD&categoryId=18206&outputSelector=AspectHistogram&; as my starting point for Honda cars, I add: aspectFilter(0).aspectName=Model&aspectFilter(0).aspectValueName=Civic and it successfully brings back Honda Civics However, if I use: aspectFilter(0).aspectName=Car_Type&aspectFilter(0).aspectValueName=Coupes it brings back 0 results despite there being 900 available in the histogram. Estates also bring back 0. I've done a successful query for Automatics, black, 5 doors. aspectFilter(0).aspectName=Transmission&aspectFilter(0).aspectValueName=Automatic&aspectFilter(1).aspectName=Colour&aspectFilter(1).aspectValueName=Black&aspectFilter(2).aspectName=Doors&aspectFilter(2).aspectValueName=5 So what doesn't work? "Car_Type". But the underscore is a valid character I believe and doesn't change when I use PHP urlencode. I've seen that underscore can be replaced by %5F but this has no effect in my queries. I'd be grateful of some assistance please.
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.

bluearmy78 avatar image
0 Likes"
bluearmy78 answered
Has anyone had any similar experiences that can help me on this please? @xian.developersupport
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
Is there a reason you are modifying "Car Type" to be "Car_Type" ? Use the actual aspect name "Car Type" and it should work fine.
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.

bluearmy78 avatar image
0 Likes"
bluearmy78 answered
You're right, using a space does bring results back when viewed in a browser, but the php curl command fails every time with an error "transfer closed with 117 bytes remaining to read". I accept this is a different problem, but only occurs when spaces are used, so related. I've asked for help on stackoverflow, but if anyone has seen this before please let me know.
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
You probably aren't urlencoding the spaces. Replace them with %20 (rawurlencode) or + (urlencode). In PHP, cURL, PHP+cURL, and other languages, you need to encode any parameters that may contain spaces for any URL requests (not just eBay APIs). Spaces are not supported in URLs. Browsers do this substitution for you, which is why it works in the browser. Don't encode the entire URL, just encode the parameters. http://php.net/manual/en/function.urlencode.php
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.