使用Golang和HereApi访问路线或地理位置的电动汽车充电站详细信息。

huangapple go评论95阅读模式
英文:

Access EV Stations Detail for a Route or Geolocation Using Golang and HereApi

问题

我正在进行一个研发项目,旨在找出特定路线/地理位置周围的充电站。在尝试访问该URL时,我收到了凭据无效的错误消息。与此同时,我可以使用相同的API密钥访问其他一些服务,但无法访问电动汽车充电站。

请问如何使用凭据访问相同的内容?期待专家社区宝贵的反馈。以下是我使用Golang尝试的代码:

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

var apikey = "XXXXXXXX"
var latitude = 42.36399
var longitude = -71.05493
var address string

func main() {
	url := "https://ev-v2.cc.api.here.com/ev/stations.json?prox=" + fmt.Sprint(latitude) + "," + fmt.Sprint(longitude) + ",5000&connectortype=31&apiKey=" + apikey

	res, err := http.Get(url)
	if err != nil {
		log.Fatalln(err)
	}
	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		log.Fatalln(err)
	}

	fmt.Println(string(body))
}
英文:

I am working on an RND Project to find out the Charging stations around a particular route/geolocation, I am getting credentials not valid error message while trying to access the URL. Meanwhile some of the other services I am able to access with the same API Key but not the EV ones.

How can I access the same using the credentials, Looking forward to valuable feedback from the expert community. Here is what I have tried using Golang.

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

var apikey = "XXXXXXXX"
var latitude = 42.36399
var longitude = -71.05493
var address string

func main() {

	url = "https://ev-v2.cc.api.here.com/ev/stations.json?prox=" + fmt.Sprint(latitude) + "," + fmt.Sprint(longitude) + ",5000&connectortype=31&apiKey=" + apikey

	res, err := http.Get(url)
	if err != nil {
		log.Fatalln(err)
	}
	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		log.Fatalln(err)
	}

	fmt.Println(string(body))
}

答案1

得分: 1

EV路线规划需要进行白名单授权。我建议您与您的AE联系,或者与我们所在地区的相关团队联系,我们这里有一个需要填写的联系表格 - https://www.here.com/contact

英文:

EV routing requires whitelisting. I would suggest please get in touch with your AE, or to get in contact with the respective team out of your region we have here a contact form you need to fill - https://www.here.com/contact

huangapple
  • 本文由 发表于 2022年11月29日 04:44:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/74606277.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定