For Zoho Services only:


I'm actually part of a bigger team at Ascent Business Solutions where we have support technicians and project consultants. Support is for smaller technical fixes but this can include developments, reports or integrations; depending on the size of the task. Projects are for more time-consuming developments such as revamps of the Zoho Suite of apps or on-site training. The advantage of a team is that if I am out-of-office for a day or so, there is always someone at Ascent Business Solutions who can deal with any queries/issues you may have.

Our support rates can be found and purchased at http://ascentbusiness.co.uk/zoho-support-2. A support bundle doesn't have an expiry date. So whether we can do what you want within the bundle and a year later need further support, if there are minutes left on the bundle then there is no additional charge.

Our project rates for bigger developments can be found at http://ascentbusiness.co.uk/crm-solutions/zoho-crm-packages-prices and will involve a dedicated project consultant along with developers who will hold your hand through the development process.

If you want help building a solution for one of the Zoho Apps in the Zoho Suite, contact us on 0121 293 8140 (UK) or by email at info@ascentbusiness.co.uk. You can also visit our website at http://ascentbusiness.co.uk.

I regularly build and specialize in 2-way API integrations for Xero, Shopify and eBay.

Zoho Deluge: Convert Map to URL Parameters

What?
A quick article on converting a Map (associative array with keys and values) into a URL string to pass as URL parameters.

How?
Let's first define a map:
copyraw
m_Payload = Map();
m_Payload.put("client_id","my-unique-client-id");
m_Payload.put("redirect_uri","https://www.joellipman.com");
m_Payload.put("response_type","code");
m_Payload.put("scope","my_api_scopes");
m_Payload.put("prompt","login");
  1.  m_Payload = Map()
  2.  m_Payload.put("client_id","my-unique-client-id")
  3.  m_Payload.put("redirect_uri","https://www.joellipman.com")
  4.  m_Payload.put("response_type","code")
  5.  m_Payload.put("scope","my_api_scopes")
  6.  m_Payload.put("prompt","login")
Great! What follows is the code I'm using to convert this:
copyraw
v_Endpoint = "https://api.joellipman.com/myapi";
l_UrlParams = List();
for each v_Key in m_Payload.keys()
{
	l_UrlParams.add(v_Key.toString() + "=" + m_Payload.get(v_Key));
}
info v_Endpoint + "?" + l_UrlParams.toString("&");

// yields https://api.joellipman.com/myapi?client_id=my-unique-client-id&redirect_uri=https://www.joellipman.com&response_type=code&scope=my_api_scopes&prompt=login
  1.  v_Endpoint = "https://api.joellipman.com/myapi"
  2.  l_UrlParams = List()
  3.  for each v_Key in m_Payload.keys() 
  4.  { 
  5.      l_UrlParams.add(v_Key.toString() + "=" + m_Payload.get(v_Key))
  6.  } 
  7.  info v_Endpoint + "?" + l_UrlParams.toString("&")
  8.   
  9.  // yields https://api.joellipman.com/myapi?client_id=my-unique-client-id&redirect_uri=https://www.joellipman.com&response_type=code&scope=my_api_scopes&prompt=login 

In Reverse
To have the reverse effect of converting a URL into a map, I'm using the following:
copyraw
v_ReturnedUrl = "https://api.joellipman.com/myapi?isAuthSuccessful=true&code=my_own_code&expires_in=299";
l_ReturnedUrlParts = v_ReturnedUrl.subString(v_ReturnedUrl.indexOf("?")+1).toList("&");
m_UrlParams = Map();
for each  r_Part in l_ReturnedUrlParts
{
	if(r_Part.contains("="))
	{
		l_ParamParts = r_Part.toList("=");
		m_UrlParams.put(l_ParamParts.get(0), l_ParamParts.get(1));
	}
}
  1.  v_ReturnedUrl = "https://api.joellipman.com/myapi?isAuthSuccessful=true&code=my_own_code&expires_in=299"
  2.  l_ReturnedUrlParts = v_ReturnedUrl.subString(v_ReturnedUrl.indexOf("?")+1).toList("&")
  3.  m_UrlParams = Map()
  4.  for each  r_Part in l_ReturnedUrlParts 
  5.  { 
  6.      if(r_Part.contains("=")) 
  7.      { 
  8.          l_ParamParts = r_Part.toList("=")
  9.          m_UrlParams.put(l_ParamParts.get(0), l_ParamParts.get(1))
  10.      } 
  11.  } 
Category: Zoho :: Article: 706

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 - Valid till 8 May 2022 3QnhmaBX7LQSRsC9hh6Je9rGQKEGNQNfPb
© 2021 Joel Lipman .com. All Rights Reserved.