How do I take arguments in erl shell?

-module(api).
-export([call_api/1]).

call_api(url) -> 
    {ok, {{_, 200, _}, _, Body}} = httpc:request(get, {url, []}, [], []),
    Body.

I run it like this:

$ erl
1> c(api).
2> api:call_api(“my-api-url-here.com”).

but its saying Description: "Authenticity is not established by certificate path validation"

1 Like

Variables start with uppercase letter, Url instead of url

1 Like
call_api(Url) -> 
   {ok, {{_, 200, _}, _, Body}} = httpc:request(get, {Url, []}, certifcate, []),
    Body.

Description: "Authenticity is not established by certificate path validation"

1 Like

I believe you might be missing TLS-related elements. Check Erlang standard library: ssl | EEF Security WG to see if it helps (namely options verify and cacerts).

1 Like