3dgeo-heidelberg / pytreedb

Python package providing a file and object-based database to store tree objects.
Other
28 stars 4 forks source link

Provide example for POST request to pytreedb for R #22

Closed lwiniwar closed 2 years ago

lwiniwar commented 2 years ago

In GitLab by @bhoefle-3dgeo on Mar 16, 2022, 18:06

lwiniwar commented 2 years ago

example:

library(httr)
library(jsonlite)

req <- list( data = c("{\"properties.species\":\"Abies alba\"}"))

res <- POST("http://syssifoss.geog.uni-heidelberg.de:5001/search", body = req, encode="form")

print(rawToChar(res$content))
data = fromJSON(rawToChar(res$content))
lwiniwar commented 2 years ago

updated example due to changes in the API:

library(httr)
library(jsonlite)

req <- list( query = c("{\"properties.species\":\"Abies alba\"}"))

res <- POST("http://syssifoss.geog.uni-heidelberg.de:5001/search", body = req, encode="form")

print(rawToChar(res$content))
data = fromJSON(rawToChar(res$content))