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

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -