\section{Recap}

\frame{\tableofcontents[currentsection]}


\begin{frame}
    \frametitle{HTTP methods}

    \structure{Request types:}
    \begin{itemize}
        \item GET : request data from a resource
        \item POST : submit data to be processed to a specified resource
        \item PUT : replaces all current representations of the resource with the request payload.
        \item DELETE
        \item HEAD : identical as GET, but without response body
        \item OPTIONS : returns supported HTTP methods
        \item PATCH : update partial resources
    \end{itemize}
\end{frame}



\begin{frame}
    \frametitle{Idempotent methods}

    \structure{Definition}\\
    Methods that can be called many times without different outcomes.

    \vfill

    \structure{Example}\\
    \begin{itemize}
        \item elixir\_awesomeness = 42 -$>$ Idempotent
        \item elixir\_awesomeness++ -$>$ Not idempotent
    \end{itemize}
\end{frame}


\begin{frame}
    \frametitle{Safe methods}

    \structure{Definition}\\
    Methods that do not modify resources.

    \vfill

    \structure{Example}\\
    \begin{itemize}
        \item GET localhost:4000/users -$>$ doesn't modify resources
        \item POST / PUT / DELETE -$>$ modifies resources
    \end{itemize}
\end{frame}



\begin{frame}
    \frametitle{Overview}

    \begin{center}
        \begin{tabular}{||c c c||}
            \hline
            Method  & Idempotent & Safe \\ [0.5ex]
            \hline\hline
            GET     & Y          & Y    \\
            \hline
            POST    & N          & N    \\
            \hline
            PUT     & Y          & N    \\
            \hline
            DELETE  & Y          & N    \\
            \hline
            HEAD    & Y          & Y    \\
            \hline
            OPTIONS & Y          & Y    \\
            \hline
            PATCH   & N          & N    \\
            \hline
        \end{tabular}
    \end{center}
\end{frame}
