Edit in JSFiddle

const base = 'https://image.maps.api.here.com/mia/1.6/route?'
const params = {
	r0: '22.319073340273345,114.16816234588623,22.320601792313163,114.16782975196838,22.320800291349947,114.16905283927917,22.321991279641566,114.16882753372192,22.322050828789333,114.16892409324645,22.322140152463337,114.16942834854125', //Latitude, Longitude
  lc0: 'red', //Line color
  app_id: 'devportal-demo-20180625',
  app_code: '9v2BkviRwi9Ot26kp2IysQ'
}

const url = base + Object.keys(params).map(key => key + '=' + params[key]).join('&');
document.querySelector('img').src = url;