For Zoho Services only:


I'm actually part of something bigger at Ascent Business Solutions recognized as the top Zoho Premium Solutions Partner in the United Kingdom.

Ascent Business Solutions offer support for smaller technical fixes and projects for larger developments, such as migrating to a ZohoCRM.  A team rather than a one-man-band is always available to ensure seamless progress and address any concerns. You'll find our competitive support rates with flexible, no-expiration bundles at https://ascentbusiness.co.uk/zoho-services/uk-zoho-support.  For larger projects, talk to our experts and receive dedicated support from our hands-on project consultants at https://ascentbusiness.co.uk/zoho-services/zoho-crm-implementation.

The team I manage specializes in coding API integrations between Zoho and third-party finance/commerce suites such as Xero, Shopify, WooCommerce, and eBay; to name but a few.  Our passion lies in creating innovative solutions where others have fallen short as well as working with new businesses, new sectors, and new ideas.  Our success is measured by the growth and ROI we deliver for clients, such as transforming a garden shed hobby into a 250k monthly turnover operation or generating a +60% return in just three days after launch through online payments and a streamlined e-commerce solution, replacing a paper-based system.

If you're looking for a partner who can help you drive growth and success, we'd love to work with you.  You can reach out to us on 0121 392 8140 (UK) or info@ascentbusiness.co.uk.  You can also visit our website at https://ascentbusiness.co.uk.

Zoho Deluge: Get All Orders from eBay

What?
Following on from my article: ZohoCRM: Get All eBay Active Listings, this is how to get all the orders from a client's eBay.

Why?
Our use-case is a data migration from eBay to a fresh instance of Zoho Inventory. In this task, we are simply getting a CSV with all the order IDs for a particular year output as a spreadsheet.

How?
Similar to how we retrieved the eBay active listings (see article link above), we're going to use the GetOrders call for order (sales) management.

copyraw
/*
    Function: 		fn_GetEbayOrders()
    Purpose: 		Queries eBay for all orders for a specified year
    Date Created:   2023-03-29 (Joel Lipman)
                    - Initial release
	Date Modified: 	2023-03-29 (Joel Lipman)
					- Added in ability to list errors and query order line item IDs (ErrCode: 21917182)
					- Modified to check that there are some orders.
					
    More Info:
    - API Explorer Test Tool: 			https://developer.ebay.com/DevZone/build-test/test-tool/default.aspx?index=0&env=production&api=trading
    - GetOrders Documentation: 			https://developer.ebay.com/Devzone/XML/docs/Reference/eBay/GetOrders.html
	- eBay Errors by Number:			https://developer.ebay.com/devzone/xml/docs/Reference/ebay/Errors/errormessages.htm
*/
//
// declare
v_Page = 1;
v_PerPage = 100;
l_Pages = List();
//
// specify the maximum number of orders you think you have on eBay (check eBay homepage and see number of sales [ will be rounded to nearest 1000 ])
// the actual number may be less than this but this is for pagination estimates
v_MaximumOrders = 10000;
v_Year = 2022;
//
// set the filter for orders by status to return: All, Active, Cancelled, CancelPending, Completed, Inactive, InProcess
v_OrderStatus = "All";
//
// calculate from and till
v_OrdersFrom = v_Year + "-01-01T00:00:00.000Z";
v_OrdersTill = v_Year + "-12-31T23:59:59.000Z";
//
// now let's generate the page list to have all the available pages
v_TotalNumberOfPages = ceil(v_MaximumOrders / v_PerPage);
l_AddPages = leftpad(" ",v_TotalNumberOfPages).replaceAll(" ",",").toList();
for each index v_Increment in l_AddPages
{
	l_Pages.add(v_Increment + 1);
}
v_TotalNumberOfPages = l_Pages.size();
//
// declare variables to store order details in a JSON or ZohoDeluge Map format
m_Response = Map();
l_JsonOrders = List();
//
// start preparing CSV file to email for export
v_ReportCSV = "Date,Order ID,Status,Amount,Currency,Notes";
l_CsvFileRows = List();
l_CsvFileRows.add(v_ReportCSV);
//
// get access token 
v_AccessToken = standalone.fn_eBay_GetAccessToken();
//
v_TradingAPIVersion = 967;
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 = "GetOrders";
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","ReturnAll");
m_Params.put("OrderStatus","All");
m_Params.put("SortingOrder","Ascending");
m_Params.put("CreateTimeFrom",v_OrdersFrom);
m_Params.put("CreateTimeTo",v_OrdersTill);
//
// select which fields to return
l_OutputFields = List();
l_OutputFields.add("OrderID");
l_OutputFields.add("OrderStatus");
l_OutputFields.add("AmountPaid");
l_OutputFields.add("CreatedTime");
l_OutputFields.add("TotalNumberOfPages");
l_OutputFields.add("TotalNumberOfEntries");
m_Params.put("OutputSelector",l_OutputFields);
//
// now lets loop through a dynamic page list
for each  v_Page in l_Pages
{
	//
	// specify which page
	m_Pagination = Map();
	m_Pagination.put("PageNumber",v_Page);
	m_Pagination.put("EntriesPerPage",v_PerPage);
	m_Params.put("Pagination",m_Pagination);
	//
	// 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>");
	//
	//info "Request Sent to eBay:";
	//info x_Params;
	//
	// send the request XML as a string
	x_ResponseBody = invokeurl
	[
		url :v_Endpoint
		type :POST
		parameters:x_Params
		headers:m_Headers
	];
	//info "Response from eBay:";
	//info x_ResponseBody;
	//
	// get pagination results from the first iteration/page
	if(v_Page == 1)
	{
		//
		// get page results
		x_PaginationResult = x_ResponseBody.subString(x_ResponseBody.indexOf("<PaginationResult"),x_ResponseBody.lastIndexOf("</PaginationResult") + 19);
		v_TotalNumberOfOrders = x_PaginationResult.executeXPath("/PaginationResult/TotalNumberOfEntries/text()").toLong();
		//
		// determine total number of pages required
		v_TotalNumberOfPages = ceil(v_TotalNumberOfOrders / v_PerPage);
		info "Total Order(s): " + v_TotalNumberOfOrders;
		info "Total Page(s): " + v_TotalNumberOfPages;
	}
	//
	// loop through orders in response
	v_OrderNodePart = "Order";
	v_OrderNodeName = v_OrderNodePart + "Array";
	//
	// check node is paired to closing tag
	if(x_ResponseBody.contains("</" + v_OrderNodeName + ">"))
	{
		x_OrderNode = x_ResponseBody.subString(x_ResponseBody.indexOf("<" + v_OrderNodeName),x_ResponseBody.lastIndexOf(v_OrderNodeName) + v_OrderNodeName.length() + 1);
		l_Orders = x_OrderNode.executeXPath("/" + v_OrderNodeName + "/" + v_OrderNodePart).toXmlList();
		for each  x_Order in l_Orders
		{
			//
			// parse the XML
			v_ThisOrderID = x_Order.executeXPath("//OrderID/text()");
			v_ThisOrderStatus = x_Order.executeXPath("//OrderStatus/text()");
			v_ThisOrderAmountPaid = x_Order.executeXPath("//AmountPaid/text()").toDecimal();
			v_ThisOrderCurrency = x_Order.executeXPath("//AmountPaid/@currencyID").executeXPath("/currencyID/text()");
			v_ThisOrderDateCreated = x_Order.executeXPath("//CreatedTime/text()");
			//
			// build JSON row
			m_Order = Map();
			m_Order.put("OrderID",v_ThisOrderID);
			m_Order.put("OrderStatus",v_ThisOrderStatus);
			m_Order.put("AmountPaid",v_ThisOrderAmountPaid);
			m_Order.put("Currency",v_ThisOrderCurrency);
			//
			v_ThisOrderDateCreated = if(!isnull(v_ThisOrderDateCreated),v_ThisOrderDateCreated.getPrefix(".").replaceFirst("T"," ",true).toTime(),zoho.currenttime).toString("yyyy-MM-dd HH:mm:ssZ");
			m_Order.put("CreatedTime",v_ThisOrderDateCreated);
			//
			l_JsonOrders.add(m_Order);
			//
			// generate CSV row for monitoring purposes
			l_CsvFileRow = List();
			l_CsvFileRow.add(v_ThisOrderDateCreated);
			l_CsvFileRow.add("\"" + v_ThisOrderID + "\"");
			l_CsvFileRow.add("\"" + v_ThisOrderStatus + "\"");
			l_CsvFileRow.add(v_ThisOrderAmountPaid);
			l_CsvFileRow.add(v_ThisOrderCurrency);
			l_CsvFileRow.add(" ");
			//
			v_CsvRow = l_CsvFileRow.toString();
			l_CsvFileRows.add(v_CsvRow);
		}
	}
	//
	//  report on errors of this page as well
	v_ErrorNodePart = "Errors";
	if(x_ResponseBody.contains("<" + v_ErrorNodePart))
	{
		x_ErrorNode = "<" + v_ErrorNodePart + "_Root>" + x_ResponseBody.subString(x_ResponseBody.indexOf("<" + v_ErrorNodePart),x_ResponseBody.lastIndexOf(v_ErrorNodePart + ">") + v_ErrorNodePart.length() + 1) + "</" + v_ErrorNodePart + "_Root>";
		l_Errors = x_ErrorNode.executeXPath("//" + v_ErrorNodePart).toXmlList();
		for each  x_Error in l_Errors
		{
			v_ThisErrorLineItemID = x_Error.executeXPath("//ErrorParameters/Value/text()");
			v_ThisErrorMessage = x_Error.executeXPath("//LongMessage/text()");
			//
			m_Error = Map();
			m_Error.put("Error Line Item ID",v_ThisErrorLineItemID);
			m_Error.put("Error Message",v_ThisErrorMessage);
			l_JsonOrders.add(m_Error);
			//
			// generate CSV row for monitoring purposes
			l_CsvFileRow = List();
			l_CsvFileRow.add("????");
			l_CsvFileRow.add("\"" + v_ThisErrorLineItemID + "\"");
			l_CsvFileRow.add(" ");
			l_CsvFileRow.add(" ");
			l_CsvFileRow.add(" ");
			l_CsvFileRow.add(v_ThisErrorMessage);
			//
			v_CsvRow = l_CsvFileRow.toString();
			l_CsvFileRows.add(v_CsvRow);
		}
	}
	//
	// break if page has exceeded max
	if(v_Page >= v_TotalNumberOfPages)
	{
		break;
	}
}
//
m_Response.put("orders",l_JsonOrders);
//
// lets send the CSV and JSON by email
if(l_JsonOrders.size() > 0)
{
	// 
	// generate a CSV list for monitoring purposes
	v_CSVFilename = "ebay-orders-" + zoho.currenttime.toString("yyyy-MM-dd-HH-mm-ss") + ".csv";
	l_CsvFileRows.add("-----------------------------" + v_CSVFilename);
	//
	// usually \n works on some systems but this one works on systems that \n doesn't
	f_CSVFile = l_CsvFileRows.toString(zoho.encryption.urlDecode("%0A")).toFile(v_CSVFilename);
	//
	// just adding these in case
	v_JsonFilename = "ebay-orders-" + zoho.currenttime.toString("yyyy-MM-dd-HH-mm-ss") + ".json";
	f_JsonFile = m_Response.toString().toFile(v_JsonFilename);
	// 
	// send via Email 
	v_CountRows = l_CsvFileRows.size() - 2;
	v_Subject = "NextWheelsTyres: " + l_JsonOrders.size() + " eBay Orders Export for year: " + v_Year;
	v_Message = "Hi there!<br /><br />Please find attached a log of <b>" + l_JsonOrders.size() + "</b> order(s) created in the year <b>"+v_Year+"</b> from eBay that was exported on <b>" + zoho.currenttime.toString("EEEE, dd-MMM-yyyy") + "</b><br /><br />This is an automated email.  Please do not reply to it.<br /><br />Kind Regards,<br /><br />The Team";
	sendmail
	[
		from :zoho.adminuserid
		to :"Joel Lipman <This email address is being protected from spambots. You need JavaScript enabled to view it.>"
		subject :v_Subject
		message :v_Message
		Attachments :file:f_CSVFile,file:f_JsonFile
	]
}
//
// Output
return "Exported " + l_JsonOrders.size() + " order(s)";
  1.  /* 
  2.      Function:         fn_GetEbayOrders() 
  3.      Purpose:         Queries eBay for all orders for a specified year 
  4.      Date Created:   2023-03-29 (Joel Lipman) 
  5.                      - Initial release 
  6.      Date Modified:     2023-03-29 (Joel Lipman) 
  7.                      - Added in ability to list errors and query order line item IDs (ErrCode: 21917182) 
  8.                      - Modified to check that there are some orders. 
  9.   
  10.      More Info: 
  11.      - API Explorer Test Tool:             https://developer.ebay.com/DevZone/build-test/test-tool/default.aspx?index=0&env=production&api=trading 
  12.      - GetOrders Documentation:             https://developer.ebay.com/Devzone/XML/docs/Reference/eBay/GetOrders.html 
  13.      - eBay Errors by Number:            https://developer.ebay.com/devzone/xml/docs/Reference/ebay/Errors/errormessages.htm 
  14.  */ 
  15.  // 
  16.  // declare 
  17.  v_Page = 1
  18.  v_PerPage = 100
  19.  l_Pages = List()
  20.  // 
  21.  // specify the maximum number of orders you think you have on eBay (check eBay homepage and see number of sales [ will be rounded to nearest 1000 ]) 
  22.  // the actual number may be less than this but this is for pagination estimates 
  23.  v_MaximumOrders = 10000
  24.  v_Year = 2022
  25.  // 
  26.  // set the filter for orders by status to return: All, Active, Cancelled, CancelPending, Completed, Inactive, InProcess 
  27.  v_OrderStatus = "All"
  28.  // 
  29.  // calculate from and till 
  30.  v_OrdersFrom = v_Year + "-01-01T00:00:00.000Z"
  31.  v_OrdersTill = v_Year + "-12-31T23:59:59.000Z"
  32.  // 
  33.  // now let's generate the page list to have all the available pages 
  34.  v_TotalNumberOfPages = ceil(v_MaximumOrders / v_PerPage)
  35.  l_AddPages = leftpad(" ",v_TotalNumberOfPages).replaceAll(" ",",").toList()
  36.  for each index v_Increment in l_AddPages 
  37.  { 
  38.      l_Pages.add(v_Increment + 1)
  39.  } 
  40.  v_TotalNumberOfPages = l_Pages.size()
  41.  // 
  42.  // declare variables to store order details in a JSON or ZohoDeluge Map format 
  43.  m_Response = Map()
  44.  l_JsonOrders = List()
  45.  // 
  46.  // start preparing CSV file to email for export 
  47.  v_ReportCSV = "Date,Order ID,Status,Amount,Currency,Notes"
  48.  l_CsvFileRows = List()
  49.  l_CsvFileRows.add(v_ReportCSV)
  50.  // 
  51.  // get access token 
  52.  v_AccessToken = standalone.fn_eBay_GetAccessToken()
  53.  // 
  54.  v_TradingAPIVersion = 967
  55.  v_Endpoint = "https://api.ebay.com/ws/api.dll"
  56.  // 
  57.  // build header 
  58.  m_Headers = Map()
  59.  m_Headers.put("X-EBAY-API-SITEID",3)
  60.  m_Headers.put("X-EBAY-API-COMPATIBILITY-LEVEL",v_TradingAPIVersion)
  61.  v_ApiCall = "GetOrders"
  62.  m_Headers.put("X-EBAY-API-CALL-NAME",v_ApiCall)
  63.  m_Headers.put("X-EBAY-API-IAF-TOKEN",v_AccessToken)
  64.  // 
  65.  // build params 
  66.  m_Params = Map()
  67.  m_Params.put("WarningLevel","High")
  68.  m_Params.put("ErrorLanguage","en_GB")
  69.  m_Params.put("DetailLevel","ReturnAll")
  70.  m_Params.put("OrderStatus","All")
  71.  m_Params.put("SortingOrder","Ascending")
  72.  m_Params.put("CreateTimeFrom",v_OrdersFrom)
  73.  m_Params.put("CreateTimeTo",v_OrdersTill)
  74.  // 
  75.  // select which fields to return 
  76.  l_OutputFields = List()
  77.  l_OutputFields.add("OrderID")
  78.  l_OutputFields.add("OrderStatus")
  79.  l_OutputFields.add("AmountPaid")
  80.  l_OutputFields.add("CreatedTime")
  81.  l_OutputFields.add("TotalNumberOfPages")
  82.  l_OutputFields.add("TotalNumberOfEntries")
  83.  m_Params.put("OutputSelector",l_OutputFields)
  84.  // 
  85.  // now lets loop through a dynamic page list 
  86.  for each  v_Page in l_Pages 
  87.  { 
  88.      // 
  89.      // specify which page 
  90.      m_Pagination = Map()
  91.      m_Pagination.put("PageNumber",v_Page)
  92.      m_Pagination.put("EntriesPerPage",v_PerPage)
  93.      m_Params.put("Pagination",m_Pagination)
  94.      // 
  95.      // convert to xml and replace root nodes 
  96.      x_Params = m_Params.toXML()
  97.      x_Params = x_Params.toString().replaceFirst("<root>","<?xml version=\"1.0\" encoding=\"utf-8\"?><" + v_ApiCall + "Request xmlns=\"urn:ebay:apis:eBLBaseComponents\">")
  98.      x_Params = x_Params.toString().replaceFirst("</root>","</" + v_ApiCall + "Request>")
  99.      // 
  100.      //info "Request Sent to eBay:"; 
  101.      //info x_Params; 
  102.      // 
  103.      // send the request XML as a string 
  104.      x_ResponseBody = invokeUrl 
  105.      [ 
  106.          url :v_Endpoint 
  107.          type :POST 
  108.          parameters:x_Params 
  109.          headers:m_Headers 
  110.      ]
  111.      //info "Response from eBay:"; 
  112.      //info x_ResponseBody; 
  113.      // 
  114.      // get pagination results from the first iteration/page 
  115.      if(v_Page == 1) 
  116.      { 
  117.          // 
  118.          // get page results 
  119.          x_PaginationResult = x_ResponseBody.subString(x_ResponseBody.indexOf("<PaginationResult"),x_ResponseBody.lastIndexOf("</PaginationResult") + 19)
  120.          v_TotalNumberOfOrders = x_PaginationResult.executeXPath("/PaginationResult/TotalNumberOfEntries/text()").toLong()
  121.          // 
  122.          // determine total number of pages required 
  123.          v_TotalNumberOfPages = ceil(v_TotalNumberOfOrders / v_PerPage)
  124.          info "Total Order(s): " + v_TotalNumberOfOrders; 
  125.          info "Total Page(s): " + v_TotalNumberOfPages; 
  126.      } 
  127.      // 
  128.      // loop through orders in response 
  129.      v_OrderNodePart = "Order"
  130.      v_OrderNodeName = v_OrderNodePart + "Array"
  131.      // 
  132.      // check node is paired to closing tag 
  133.      if(x_ResponseBody.contains("</" + v_OrderNodeName + ">")) 
  134.      { 
  135.          x_OrderNode = x_ResponseBody.subString(x_ResponseBody.indexOf("<" + v_OrderNodeName),x_ResponseBody.lastIndexOf(v_OrderNodeName) + v_OrderNodeName.length() + 1)
  136.          l_Orders = x_OrderNode.executeXPath("/" + v_OrderNodeName + "/" + v_OrderNodePart).toXmlList()
  137.          for each  x_Order in l_Orders 
  138.          { 
  139.              // 
  140.              // parse the XML 
  141.              v_ThisOrderID = x_Order.executeXPath("//OrderID/text()")
  142.              v_ThisOrderStatus = x_Order.executeXPath("//OrderStatus/text()")
  143.              v_ThisOrderAmountPaid = x_Order.executeXPath("//AmountPaid/text()").toDecimal()
  144.              v_ThisOrderCurrency = x_Order.executeXPath("//AmountPaid/@currencyID").executeXPath("/currencyID/text()")
  145.              v_ThisOrderDateCreated = x_Order.executeXPath("//CreatedTime/text()")
  146.              // 
  147.              // build JSON row 
  148.              m_Order = Map()
  149.              m_Order.put("OrderID",v_ThisOrderID)
  150.              m_Order.put("OrderStatus",v_ThisOrderStatus)
  151.              m_Order.put("AmountPaid",v_ThisOrderAmountPaid)
  152.              m_Order.put("Currency",v_ThisOrderCurrency)
  153.              // 
  154.              v_ThisOrderDateCreated = if(!isnull(v_ThisOrderDateCreated),v_ThisOrderDateCreated.getPrefix(".").replaceFirst("T"," ",true).toTime(),zoho.currenttime).toString("yyyy-MM-dd HH:mm:ssZ")
  155.              m_Order.put("CreatedTime",v_ThisOrderDateCreated)
  156.              // 
  157.              l_JsonOrders.add(m_Order)
  158.              // 
  159.              // generate CSV row for monitoring purposes 
  160.              l_CsvFileRow = List()
  161.              l_CsvFileRow.add(v_ThisOrderDateCreated)
  162.              l_CsvFileRow.add("\"" + v_ThisOrderID + "\"")
  163.              l_CsvFileRow.add("\"" + v_ThisOrderStatus + "\"")
  164.              l_CsvFileRow.add(v_ThisOrderAmountPaid)
  165.              l_CsvFileRow.add(v_ThisOrderCurrency)
  166.              l_CsvFileRow.add(" ")
  167.              // 
  168.              v_CsvRow = l_CsvFileRow.toString()
  169.              l_CsvFileRows.add(v_CsvRow)
  170.          } 
  171.      } 
  172.      // 
  173.      //  report on errors of this page as well 
  174.      v_ErrorNodePart = "Errors"
  175.      if(x_ResponseBody.contains("<" + v_ErrorNodePart)) 
  176.      { 
  177.          x_ErrorNode = "<" + v_ErrorNodePart + "_Root>" + x_ResponseBody.subString(x_ResponseBody.indexOf("<" + v_ErrorNodePart),x_ResponseBody.lastIndexOf(v_ErrorNodePart + ">") + v_ErrorNodePart.length() + 1) + "</" + v_ErrorNodePart + "_Root>"
  178.          l_Errors = x_ErrorNode.executeXPath("//" + v_ErrorNodePart).toXmlList()
  179.          for each  x_Error in l_Errors 
  180.          { 
  181.              v_ThisErrorLineItemID = x_Error.executeXPath("//ErrorParameters/Value/text()")
  182.              v_ThisErrorMessage = x_Error.executeXPath("//LongMessage/text()")
  183.              // 
  184.              m_Error = Map()
  185.              m_Error.put("Error Line Item ID",v_ThisErrorLineItemID)
  186.              m_Error.put("Error Message",v_ThisErrorMessage)
  187.              l_JsonOrders.add(m_Error)
  188.              // 
  189.              // generate CSV row for monitoring purposes 
  190.              l_CsvFileRow = List()
  191.              l_CsvFileRow.add("????")
  192.              l_CsvFileRow.add("\"" + v_ThisErrorLineItemID + "\"")
  193.              l_CsvFileRow.add(" ")
  194.              l_CsvFileRow.add(" ")
  195.              l_CsvFileRow.add(" ")
  196.              l_CsvFileRow.add(v_ThisErrorMessage)
  197.              // 
  198.              v_CsvRow = l_CsvFileRow.toString()
  199.              l_CsvFileRows.add(v_CsvRow)
  200.          } 
  201.      } 
  202.      // 
  203.      // break if page has exceeded max 
  204.      if(v_Page >= v_TotalNumberOfPages) 
  205.      { 
  206.          break
  207.      } 
  208.  } 
  209.  // 
  210.  m_Response.put("orders",l_JsonOrders)
  211.  // 
  212.  // lets send the CSV and JSON by email 
  213.  if(l_JsonOrders.size() > 0) 
  214.  { 
  215.      // 
  216.      // generate a CSV list for monitoring purposes 
  217.      v_CSVFilename = "ebay-orders-" + zoho.currenttime.toString("yyyy-MM-dd-HH-mm-ss") + ".csv"
  218.      l_CsvFileRows.add("-----------------------------" + v_CSVFilename)
  219.      // 
  220.      // usually \n works on some systems but this one works on systems that \n doesn't 
  221.      f_CSVFile = l_CsvFileRows.toString(zoho.encryption.urlDecode("%0A")).toFile(v_CSVFilename)
  222.      // 
  223.      // just adding these in case 
  224.      v_JsonFilename = "ebay-orders-" + zoho.currenttime.toString("yyyy-MM-dd-HH-mm-ss") + ".json"
  225.      f_JsonFile = m_Response.toString().toFile(v_JsonFilename)
  226.      // 
  227.      // send via Email 
  228.      v_CountRows = l_CsvFileRows.size() - 2
  229.      v_Subject = "NextWheelsTyres: " + l_JsonOrders.size() + " eBay Orders Export for year: " + v_Year; 
  230.      v_Message = "Hi there!<br /><br />Please find attached a log of <b>" + l_JsonOrders.size() + "</b> order(s) created in the year <b>"+v_Year+"</b> from eBay that was exported on <b>" + zoho.currenttime.toString("EEEE, dd-MMM-yyyy") + "</b><br /><br />This is an automated email.  Please do not reply to it.<br /><br />Kind Regards,<br /><br />The Team"
  231.      sendmail 
  232.      [ 
  233.          from :zoho.adminuserid 
  234.          to :"Joel Lipman <info+This email address is being protected from spambots. You need JavaScript enabled to view it.>" 
  235.          subject :v_Subject 
  236.          message :v_Message 
  237.          Attachments :file:f_CSVFile,file:f_JsonFile 
  238.      ] 
  239.  } 
  240.  // 
  241.  // Output 
  242.  return "Exported " + l_JsonOrders.size() + order(s)"

Error(s):
  • ErrorCode (21917182) Version 1289 - Invalid orderlineids. OrderLineItemIDs 25#########-296######## could not be found. Associated Items may have been deleted or removed.: --> Get more information by querying the item in the order --> Order Array was blank using GetOrderTransactions. --> Unresolved: Ouput line item ID as order ID and error message in notes column.
  • Invalid value for header "X-EBAY-API-DETAIL-LEVEL": --> I was trying to send JSON when it should be an XML request.
  • One or more specified index values were invalid. Index value must range between 0 and the length of the text Line Number:173: --> Add check if <Errors> tag exists in response
Category: Zoho :: Article: 845

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

Related Articles

Joes Revolver Map

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.