View Source FritzApi.Client (fritz_api v3.0.0)

A FritzApi API Client

Summary

Functions

Authenticate with the FritzApi API using the name and password of the user.

Creates a new FritzApi API client.

Types

@opaque t()

Functions

Link to this function

login(client, username, password)

View Source
@spec login(t(), String.t(), String.t()) :: {:ok, t()} | {:error, FritzApi.Error.t()}

Authenticate with the FritzApi API using the name and password of the user.

A valid session ID is required in order to interact with the FritzBox API.

Each application should only acquire a single session ID since the number of sessions to a FritzBox is limited.

In principle, each session ID has a validity of 60 Minutes whereby the validity period gets extended with every access to the API. However, if any application tries to access the API with an invalid session ID, all other sessions get terminated.

Examples

iex> {:ok, client} = FritzApi.Client.new()
...>                 |> FritzApi.Client.login(username, password)
{:ok, %FritzApi.Client{}}
@spec new(Keyword.t()) :: t()

Creates a new FritzApi API client.

Options

  • :base_url - the base URL for all endpoints (default: http://fritz.box)

Examples

iex> client = FritzApi.Client.new()
%FritzApi.Client{}