Cosume rest service in erlang -
Cosume rest service in erlang -
hey trying consume rest service in erlang,
the module have written looks this.
but throwing issues.any
thought if missing something
-module(mod_rest_casaandra). -author("root"). %% api -export([get_keywords/0]). -define(base_url, "http://localhost:8080/users"). get_keywords()-> header ="", contenttype = "application/json", body = "", method=get, httpoptions=[], options=[], url = ?base_url, r =httpc:request(method, {url,header}, httpoptions, options).
to able run requests httpc
requires inets
application started. suspect didn't start before running request. illustration below works fine:
application:start(inets), httpc:request(get, {"http://google.com", []}, [], []).
besides pay attending headers
(in illustration header
). defined as
headers() = [header()] header() = {field(), value()} field() = string() value() = string()
but utilize ""
it. work in case because ""
equal []
, careful - can't utilize like
header = "content-type: text/plain"
here.
rest erlang
Comments
Post a Comment