I'm new to eBay's API, have been creating url string and appending it to a JS-created 'script' tag, only been calling findItem / findItemAdvanced so far and had no problems receiving and processing the response.
Problem is I tried a getSingleItem request and wada-ya-know error after error.
First Attempt:
<script>
url='htt'+'p://open.api.ebay.com/shopping?'
+'callname=GetSingleItem'
+'&'+'responseencoding=XML'
+'&'+'appid=********-2a4d-4b23-8d37-defc1bbb868f'
+'&'+'siteid=0'
+'&'+'version=515'
+'&'+'ItemID=191467818411'
+'&'+'callback=funCB'
/******************************/
elm=document.createElement('script')
elm.src=url
document.body.appendChild(elm)
</script>
Which is an exact duplicate of the method for the find call except for the url & REST-PAYLOAD:
url='htt'+'p://svcs.ebay.com/services/search/FindingService/v1'
+'?OPERATION-NAME=findItemsAdvanced'
+'&SERVICE-VERSION=1.0.0'
+'&SECURITY-APPNAME=********-2a4d-4b23-8d37-defc1bbb868f'
+'&GLOBAL-ID=EBAY-GB'
+'&RESPONSE-DATA-FORMAT=XML'
+'&REST-PAYLOAD=true'
So I ask myself why, go on the hunt, find out about several different methods to make the call & finally decide that the jQuery $.ajax() GET/POST method is best suited to my limited coding capability.
After much practice I came up with a call that works for the finding but not the damn getItem url.
$(document).ready(function(){
/******************************
url='htt'+'p://svcs.ebay.com/services/search/FindingService/v1'
+'?OPERATION-NAME=findItemsAdvanced'
+'&SERVICE-VERSION=1.0.0'
+'&SECURITY-APPNAME=********-2a4d-4b23-8d37-defc1bbb868f'
+'&GLOBAL-ID=EBAY-GB'
+'&RESPONSE-DATA-FORMAT=XML'
+'&REST-PAYLOAD=true'
+'&paginationInput.entriesPerPage=3'
+'&keywords=charizard'
/******************************/
url='htt'+'p://open.api.ebay.com/shopping?'
+'callname=GetSingleItem'
+'&'+'responseencoding=XML'
+'&'+'appid=********-2a4d-4b23-8d37-defc1bbb868f'
+'&'+'siteid=0'
+'&'+'version=515'
+'&'+'ItemID=191467818411'
+'&'+'IncludeSelector=Description'
/************************************/
var id;
$.ajax({
type: 'GET',
url: url,
dataType: 'jsonp',
jsonp: 'callbackname',
success: function(xml,status,request){ console.log(xml); },
error: function(request,status,error){ alert('Status: '+status+'\n\nError: '+error); },
complete: function(request,status){ alert('Finished & '+status); }
});
});
I've already had to fight past the xml/jsonp barrier to get this far and now this error:
Resource interpreted as Script but transferred with MIME type text/xml
Is popping up no matter what I try to get my head around.