Google 지역 API를 통해 앱 범위 내에 장소를 추가하려고합니다. 이것을 위해 저는 골란을 사용하고 있습니다. 하지만 아무런 결과가 나오지 않고 계속 오류 메시지가 표시됩니다.Google 장소 API를 통해 장소를 추가 할 때 비어있는 응답을받습니다.
여기에 내 코드
```다음``
type latlng struct {
lat, lng float64
}
type newPlace struct {
location latlng
accuracy int
name string
phone_number string
address string
types string
}
func main() {
requestUrl := "https://maps.googleapis.com/maps/api/place/add/json?key=<MYAPIKEY>"
obj := newPlace{
location: latlng{
lat: 52.1502824,
lng: 38.2643063,
},
name: "some field",
types: "storage",
}
bodyBytes, err := json.Marshal(&obj)
if err != nil {
panic(err)
}
body := bytes.NewReader(bodyBytes)
rsp, err := http.NewRequest("POST", requestUrl, body)
if err != nil {
log.Fatal(err)
}
defer rsp.Body.Close()
body_byte, err := ioutil.ReadAll(rsp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body_byte))
}
`내가 다음에 문서입니다. https://developers.google.com/places/web-service/add-place
나는 골란에 조금 익숙하다. 어떤 도움이 많이 주어질 것이다.
감사합니다. 그러나 이제 응답이 잘못되었습니다. 내가 왜 ok 응답을 못하는지 알 겠어? –
전체 오류를 복사 할 수 있습니까? –
{ "상태": "INVALID_REQUEST" } –