This is the function to get the line item order/transaction from eBay if you give it the eBay Item ID as a parameter.
Why?
Mostly for debugging but here's the code that will quickly get the XML of a GetItemTransactions request to eBay.
How?
You'll need an access token for eBay which I documented on how you can generate one in my article: Zoho Creator: Push to eBay Listings. Then you can use the following code, note that the parameter is the eBay Item ID:
void API.fn_eBayQuery_GetItemTransaction(int p_ItemID) { /* Function: fn_eBayQuery_GetItemTransaction() Input: int p_ItemID (eBay Item ID) Purpose: Fetches a line item transaction per item ID Date Created: 2022-01-22 (Joellipman - Joel Lipman) - Initial release More Info: - API Explorer Test Tool: https://developer.ebay.com/DevZone/build-test/test-tool/default.aspx?index=0&env=production&api=trading - GetItemTransactions Documentation: https://developer.ebay.com/devzone/xml/docs/Reference/eBay/GetItemTransactions.html */ v_Found = 0; v_Updated = 0; v_Page = 1; v_PerPage = 10; m_Output = Map(); r_Api = API_Integration[Connection_Name == "eBay API (Production)"]; if(r_Api.count() > 0) { v_AccessToken = thisapp.API.fn_eBayConnect_AccessToken(); v_TradingAPIVersion = r_Api.API_Version; v_Endpoint = "https://api.ebay.com/ws/api.dll"; // // build header m_Headers = Map(); m_Headers.put("X-EBAY-API-SITEID",3); m_Headers.put("X-EBAY-API-COMPATIBILITY-LEVEL",v_TradingAPIVersion); v_ApiCall = "GetItemTransactions"; m_Headers.put("X-EBAY-API-CALL-NAME",v_ApiCall); m_Headers.put("X-EBAY-API-IAF-TOKEN",v_AccessToken); // // build params m_Params = Map(); m_Params.put("WarningLevel","High"); m_Params.put("ErrorLanguage","en_GB"); m_Params.put("DetailLevel","ItemReturnCategories"); // // include fixed price items m_Pagination = Map(); m_Pagination.put("PageNumber",v_Page); m_Pagination.put("EntriesPerPage",v_PerPage); m_Params.put("Pagination",m_Pagination); //m_ActiveList.put("Sort","ItemID"); m_Params.put("ItemID",p_ItemID); // // convert to xml and replace root nodes x_Params = m_Params.toXML(); x_Params = x_Params.toString().replaceFirst("<root>","<?xml version=\"1.0\" encoding=\"utf-8\"?><" + v_ApiCall + "Request xmlns=\"urn:ebay:apis:eBLBaseComponents\">"); x_Params = x_Params.toString().replaceFirst("</root>","</" + v_ApiCall + "Request>"); // // send the request XML as a string r_ResponseXML = invokeurl [ url :v_Endpoint type :POST parameters:x_Params headers:m_Headers ]; // // output response info r_ResponseXML; /* // // if successful then read the response if(r_ResponseXML.contains("<Ack>Success</Ack>")) { // // parse the data v_MainNode = "Item"; x_MainNode = r_ResponseXML.subString(r_ResponseXML.indexOf("<" + v_MainNode),r_ResponseXML.lastIndexOf("</" + v_MainNode) + v_MainNode.length() + 3); } */ } }
- void API.fn_eBayQuery_GetItemTransaction(int p_ItemID)
- {
- /*
- Function: fn_eBayQuery_GetItemTransaction()
- Input: int p_ItemID (eBay Item ID)
- Purpose: Fetches a line item transaction per item ID
- Date Created: 2022-01-22 (Joellipman - Joel Lipman)
- - Initial release
- More Info:
- - API Explorer Test Tool: https://developer.ebay.com/DevZone/build-test/test-tool/default.aspx?index=0&env=production&api=trading
- - GetItemTransactions Documentation: https://developer.ebay.com/devzone/xml/docs/Reference/eBay/GetItemTransactions.html
- */
- v_Found = 0;
- v_Updated = 0;
- v_Page = 1;
- v_PerPage = 10;
- m_Output = Map();
- r_Api = API_Integration[Connection_Name == "eBay API (Production)"];
- if(r_Api.count() > 0)
- {
- v_AccessToken = thisapp.API.fn_eBayConnect_AccessToken();
- v_TradingAPIVersion = r_Api.API_Version;
- v_Endpoint = "https://api.ebay.com/ws/api.dll";
- //
- // build header
- m_Headers = Map();
- m_Headers.put("X-EBAY-API-SITEID",3);
- m_Headers.put("X-EBAY-API-COMPATIBILITY-LEVEL",v_TradingAPIVersion);
- v_ApiCall = "GetItemTransactions";
- m_Headers.put("X-EBAY-API-CALL-NAME",v_ApiCall);
- m_Headers.put("X-EBAY-API-IAF-TOKEN",v_AccessToken);
- //
- // build params
- m_Params = Map();
- m_Params.put("WarningLevel","High");
- m_Params.put("ErrorLanguage","en_GB");
- m_Params.put("DetailLevel","ItemReturnCategories");
- //
- // include fixed price items
- m_Pagination = Map();
- m_Pagination.put("PageNumber",v_Page);
- m_Pagination.put("EntriesPerPage",v_PerPage);
- m_Params.put("Pagination",m_Pagination);
- //m_ActiveList.put("Sort","ItemID");
- m_Params.put("ItemID",p_ItemID);
- //
- // convert to xml and replace root nodes
- x_Params = m_Params.toXML();
- x_Params = x_Params.toString().replaceFirst("<root>","<?xml version=\"1.0\" encoding=\"utf-8\"?><" + v_ApiCall + "Request xmlns=\"urn:ebay:apis:eBLBaseComponents\">");
- x_Params = x_Params.toString().replaceFirst("</root>","</" + v_ApiCall + "Request>");
- //
- // send the request XML as a string
- r_ResponseXML = invokeUrl
- [
- url :v_Endpoint
- type :POST
- parameters:x_Params
- headers:m_Headers
- ];
- //
- // output response
- info r_ResponseXML;
- /*
- //
- // if successful then read the response
- if(r_ResponseXML.contains("<Ack>Success</Ack>"))
- {
- //
- // parse the data
- v_MainNode = "Item";
- x_MainNode = r_ResponseXML.subString(r_ResponseXML.indexOf("<" + v_MainNode),r_ResponseXML.lastIndexOf("</" + v_MainNode) + v_MainNode.length() + 3);
- }
- */
- }
- }