@@ -359,6 +327,7 @@ func country(w http.ResponseWriter, r *http.Request){
...
@@ -359,6 +327,7 @@ func country(w http.ResponseWriter, r *http.Request){
io.WriteString(w,string(e))
io.WriteString(w,string(e))
}
}
}
}
}
funcspecies(whttp.ResponseWriter,r*http.Request){
funcspecies(whttp.ResponseWriter,r*http.Request){
//io.WriteString(w, "\nspecies\n\n")
//io.WriteString(w, "\nspecies\n\n")
...
@@ -369,7 +338,7 @@ func species(w http.ResponseWriter, r *http.Request){
...
@@ -369,7 +338,7 @@ func species(w http.ResponseWriter, r *http.Request){
resp,err:=http.Get("http://api.gbif.org/v1/species/"+filtred)//runs api call with that paramter
resp,err:=http.Get("http://api.gbif.org/v1/species/"+filtred)//runs api call with that paramter
ifresp.StatusCode==404{
ifresp.StatusCode==404{
io.WriteString(w,"404")//if input is invalid we do an 404 check and writes that out on the page if that is the case
io.WriteString(w,"404")//if input is invalid we do an 404 check and writes that out on the page if that is the case
println(resp.StatusCode)
}else{
}else{
iferr!=nil{
iferr!=nil{
...
@@ -433,7 +402,7 @@ func species(w http.ResponseWriter, r *http.Request){
...
@@ -433,7 +402,7 @@ func species(w http.ResponseWriter, r *http.Request){
respYear,err:=http.Get("http://api.gbif.org/v1/species/"+strconv.Itoa(namekeyInt)+"/name")//uses the namekey from the species call to find year in /name
respYear,err:=http.Get("http://api.gbif.org/v1/species/"+strconv.Itoa(namekeyInt)+"/name")//uses the namekey from the species call to find year in /name
println(respYear.StatusCode)
iferr!=nil{
iferr!=nil{
print("error\n")
print("error\n")
log.Fatalln(err)
log.Fatalln(err)
...
@@ -481,6 +450,7 @@ func diag(w http.ResponseWriter, r *http.Request){
...
@@ -481,6 +450,7 @@ func diag(w http.ResponseWriter, r *http.Request){
* if the site is unreachable the status code is sat to 503 (service unaviable)
* if the site is unreachable the status code is sat to 503 (service unaviable)
*/
*/
respGbif,err:=http.Get("http://api.gbif.org/")
respGbif,err:=http.Get("http://api.gbif.org/")
ifrespGbif==nil{
ifrespGbif==nil{
gbifCode=503
gbifCode=503
}else{
}else{
...
@@ -532,13 +502,7 @@ func diag(w http.ResponseWriter, r *http.Request){
...
@@ -532,13 +502,7 @@ func diag(w http.ResponseWriter, r *http.Request){